another simple C question please...
another simple C question please...
- Subject: another simple C question please...
- From: David Thorp <email@hidden>
- Date: Sat, 30 Aug 2003 00:06:33 +1000
Greetings...
I wonder if any of you could help me on this one please. Thanks again
to everyone for all the help in the past. This one's pretty simple I
think...
In short, is there any way, before reading in a character from a file
(using something like: ch = fgetc (theFile)), to instead find out what
the next character is, before actually reading it and moving the file
position indicator along one?
------------------
For a more lengthy explanation of what I'm trying to do:
I'm using functions like:
int NextCharsOfFileToInteger (FILE *theFile, char parser)
{
int result = 0;
char ch;
while ( (ch = fgetc (theFile)) != parser )
{
result = (result * 10) + (ch-'0');
}
return result;
}
and I'll of course pass a file pointer and a character to this function.
I wouldn't be surprised if there's a better way to do this particular
function, and if so I'm all ears, but my question above is still
relevant, because I have a few functions like this reading in
characters from the file up to a certain character and then doing one
thing or another with them.
The question is, I want to be sure before I get into this function that
the next character is NOT certain things. I don't want the function to
have to figure it out.
----------------
Can anyone help please?
Thanks in advance!
David.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.