Here's a bit of my code:
I would like to read the strings in the array(or even a pointer), and seperate the data in the string.Code:struct data { int month, day, year, hour, minute, number; char string1[2]; char string2[FILENAMELENGTH]; char stringstorage[LINELENGTH]; /* Used to store strings from file */ } LineData[NUMBEROFFILES]; while( (fgets(LineData[count].stringstorage, LINELENGTH , openfile) != NULL) && (count < NUMBEROFFILES) ) { /* code to process string */ count++; lastfilecount = count; }
I am thinking something similar to:
but using the array "LineData[count].stringstorage" as a source, instead of using a file.Code:fscanf(openfile, "%d/%d/%d %d:%d %s %d %s", &LineData[count].month, &LineData[count].day, &LineData[count].year, &LineData[count].hour, &LineData[count].minute, LineData[count].string1, &LineData[count].number, &LineData[count].string2);
I know how to read strings from keyboard input(gets), and files(fscanf), but strangely enough, I don't know how to read strings which sit in an array, or a pointer. And my C book isn't of any help.
I did a search in the forums, but can't find anything that I could use. Maybe because I am not using the right keywords.
Thanks.![]()



LinkBack URL
About LinkBacks






