August 22nd, 2003, 12:05 AM
-
look at the string functions like
strstr() (or lstrstr() )
strcmp() (or lstrcmp() )
ect.
Post some code and we will correct.
It may be better to write the file in binary. Unless you want to be able to read the actual file (in notepad ect)
In binary you can create a structure.
Then you can read and write the file using the structure. Much simpler than a text file as the size of each record is constant (which is not true for a text file).
The essence of Christianity is told us in the Garden of Eden history. The fruit that was forbidden was on the Tree of Knowledge. The subtext is, All the suffering you have is because you wanted to find out what was going on. You could be in the Garden of Eden if you had just kept your f***ing mouth shut and hadn't asked any questions.
Frank Zappa
August 22nd, 2003, 08:06 AM
-
Originally posted by TechNoFear
look at the string functions like
strstr() (or lstrstr() )
strcmp() (or lstrcmp() )
ect.
Post some code and we will correct.
Hi TechNoFear ^_^
yeah...thanks a lot...I have solved it...
I use strcmp to compare the string :)
but now, I have another problem....
it's the switch case...
while (choice != 4){
switch (choice)
case 1:
while ( fscanf(filePtr, "%s %s %s", &my_data.gureiI_id, &my_data.fans_id, &my_data.height) != EOF)
{
strcmp( my_data.gurei_id, "HAHA");
printf("Hello_HAHA\n");
}
break;
case 2:
printf("Hello_HIHI\n");
break;
when I disabled case 2, the program can run very well, but once i enable the case 2...when i compile that time, an error pops up saying that it is an illegal case...
do you know why is this happening?
thanks
August 23rd, 2003, 04:15 AM
-
can’t we use do while inside case?
August 24th, 2003, 06:02 AM
-
It's best not to do very much inside of a switch statement other than jump to another portion of the program. I'm not sure what the reasons are, but if you ever step through a program's execution while it's in a switch statement, you'll see it jumping around a bit. Better to call a function that will do what you want.
Clay Dowling
Lazarus Notes
Articles and commentary on web development
http://www.lazarusid.com/notes/