• 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
Re: another simple C question please...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: another simple C question please...


  • Subject: Re: another simple C question please...
  • From: "John Baker" <email@hidden>
  • Date: Fri, 29 Aug 2003 09:47:50 -0500

ch = peek(theFile)

peek() looks at the next charachter without consuming it.

John Baker

----- Original Message -----
From: "David Thorp" <email@hidden>
To: <email@hidden>
Cc: "Joe Osborn" <email@hidden>
Sent: Friday, August 29, 2003 9:06 AM
Subject: another simple C question please...


> 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.
_______________________________________________
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.

References: 
 >another simple C question please... (From: David Thorp <email@hidden>)

  • Prev by Date: return two values at once from C function?
  • Next by Date: Re: another simple C question please...
  • Previous by thread: Re: another simple C question please...
  • Next by thread: Re: another simple C question please...
  • Index(es):
    • Date
    • Thread