• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
another simple C question please...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: another simple C question please...
      • From: "John Baker" <email@hidden>
    • Re: another simple C question please...
      • From: "John Baker" <email@hidden>
    • Re: another simple C question please...
      • From: "Alastair J.Houghton" <email@hidden>
    • Re: another simple C question please...
      • From: Rustam Muginov <email@hidden>
  • Prev by Date: Re: invoke action
  • Next by Date: Re: another simple C question please...
  • Previous by thread: Re: Segfault on NSKeyedUnarchiver release
  • Next by thread: Re: another simple C question please...
  • Index(es):
    • Date
    • Thread