Click here to Skip to main content
15,889,595 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Terminating explorer.exe Pin
Kenny McKee15-Mar-09 13:25
Kenny McKee15-Mar-09 13:25 
QuestionRe: Terminating explorer.exe Pin
hxhl9515-Mar-09 13:40
hxhl9515-Mar-09 13:40 
AnswerRe: Terminating explorer.exe Pin
Kenny McKee15-Mar-09 17:54
Kenny McKee15-Mar-09 17:54 
GeneralRe: Terminating explorer.exe [modified] Pin
hxhl9516-Mar-09 8:47
hxhl9516-Mar-09 8:47 
GeneralRe: Terminating explorer.exe Pin
Kenny McKee16-Mar-09 9:40
Kenny McKee16-Mar-09 9:40 
AnswerRe: Terminating explorer.exe Pin
Hamid_RT15-Mar-09 19:43
Hamid_RT15-Mar-09 19:43 
GeneralRe: Terminating explorer.exe Pin
hxhl9516-Mar-09 8:37
hxhl9516-Mar-09 8:37 
Questionhow to split input string into 4 components Pin
nyc_68015-Mar-09 9:37
nyc_68015-Mar-09 9:37 
Sample input string

james 35 bond 30
berry 40 bond 37

The program must separte each line into 4 parts. first name, age, last name, and age+7, the following code is a sample of with only 2 component, I don't know how to do it with 4 components. Could someone edit the code for me please.



[CODE]void main(int argc, char *argv[])
{
struct person list[];
int i,n;
char *ch, *ch1;
char buf[256];
FILE *file1;
i=0;
fgets(buf,250,file1);

while(!feof(file1))
{
ch=strchr(buf,'\n');
if (ch!=NULL) *ch='\0';
else break;
ch = strchr(buf, ' ');
if(ch!=NULL)
{
*ch='\0';
ch1=++ch; //age

}
else break;
strcpy(list[i].lastname,buf);
list[i].age=atoi(ch1);
i++;
fgets(buf,256,file1);
}

n=i;
for(i=0;i<n;i++)
printf("%s is %d years, first name is %s\n", list[i].lastname, list[i].age);
}[/CODE]
AnswerRe: how to split input string into 4 components Pin
Stuart Dootson15-Mar-09 10:56
professionalStuart Dootson15-Mar-09 10:56 
GeneralRe: how to split input string into 4 components Pin
nyc_68015-Mar-09 13:15
nyc_68015-Mar-09 13:15 
GeneralRe: how to split input string into 4 components Pin
Stuart Dootson15-Mar-09 14:12
professionalStuart Dootson15-Mar-09 14:12 
AnswerRe: how to split input string into 4 components Pin
Joe Woodbury15-Mar-09 17:27
professionalJoe Woodbury15-Mar-09 17:27 
QuestionCDialogBar on a CDialog Pin
hatemtaleb15-Mar-09 7:04
hatemtaleb15-Mar-09 7:04 
AnswerRe: CDialogBar on a CDialog Pin
hatemtaleb15-Mar-09 10:00
hatemtaleb15-Mar-09 10:00 
Questionsimple c++ questions Pin
Mohammadj15-Mar-09 6:02
Mohammadj15-Mar-09 6:02 
AnswerRe: simple c++ questions Pin
Iain Clarke, Warrior Programmer15-Mar-09 6:22
Iain Clarke, Warrior Programmer15-Mar-09 6:22 
QuestionRe: simple c++ questions Pin
Mohammadj15-Mar-09 7:19
Mohammadj15-Mar-09 7:19 
AnswerRe: simple c++ questions Pin
Iain Clarke, Warrior Programmer15-Mar-09 8:09
Iain Clarke, Warrior Programmer15-Mar-09 8:09 
AnswerRe: simple c++ questions Pin
CPallini15-Mar-09 8:13
mveCPallini15-Mar-09 8:13 
GeneralRe: simple c++ questions Pin
Mohammadj16-Mar-09 7:30
Mohammadj16-Mar-09 7:30 
QuestionRe: simple c++ questions Pin
CPallini16-Mar-09 8:43
mveCPallini16-Mar-09 8:43 
AnswerRe: simple c++ questions Pin
Mohammadj18-Mar-09 9:28
Mohammadj18-Mar-09 9:28 
GeneralRe: simple c++ questions Pin
CPallini18-Mar-09 13:15
mveCPallini18-Mar-09 13:15 
GeneralRe: simple c++ questions Pin
Mohammadj19-Mar-09 1:07
Mohammadj19-Mar-09 1:07 
QuestionRe: simple c++ questions Pin
CPallini19-Mar-09 3:45
mveCPallini19-Mar-09 3:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.