Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

c - How to add characters to reach the maximum size of a char[] -


i have following part of code :

for(int i=0;i<n;i++) {     printf("student %d\n",i+1);     printf("enter name : ");     scanf("%s",&(student+i)->name);     fflush(stdin);      lengthname = strlen((student+i)->name);     while(lengthname !='\0')     {      }}  

when length shorter 10, add hyphens until reaching maximum size. ex : john =>> 6 hyphens added

i know how in csharp can't figure out in c. of give me lights please?

ps : oh yes variable name char name[10+1] , part of structure called student.

this simple seems must missing something.

lengthname = strlen(student[i].name); while (lengthname < 10)   student[i].name[lengthname++] = '-'; student[i].name[lengthname] = '\0'; 

perhaps confused c#'s (presumed) possession of first-class string type? no such thing in c, bare arrays of characters; @ once tedious (you have memory management yourself) , liberating (as see above).


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -