943,900 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 910
  • C++ RSS
Aug 10th, 2009
0

file handling

Expand Post »
Hello..,,
I have read about a function used in file handling named as "peek".
If anyone knows about this function then plz tell me.....
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
sara khan is offline Offline
33 posts
since Mar 2009
Aug 10th, 2009
0

Re: file handling

I've found 4 functions with start "Peek" (and they was found at win32.hlp, that you could find with google), that are:
PeekConsoleInput
PeekMessage
PeekNamedPipe
PeekPenInput
Searching on msdn will give you the required information, hope it helps =).
Reputation Points: 11
Solved Threads: 6
Junior Poster
jen140 is offline Offline
116 posts
since Jan 2009
Aug 10th, 2009
0

Re: file handling

peek basically reads the next available character without moving the file pointer.

for example if text file contains the following text
Quote ...
Hello, World
and if you execute the following psuedo Code
cpp Syntax (Toggle Plain Text)
  1. int main ()
  2. {
  3. // open stream.
  4. char v = f.peek();
  5.  
  6. // the below line will print 'H' but will not extract this character from stream.
  7. cout << v <<endl;
  8. }
if you don't want to move your reading cursor and wants to check which character will be read next you should use peek.
Last edited by Laiq Ahmed; Aug 10th, 2009 at 6:10 am. Reason: add the code tag
Reputation Points: 113
Solved Threads: 20
Junior Poster
Laiq Ahmed is offline Offline
147 posts
since Jun 2006
Aug 10th, 2009
0

Re: file handling

can u tell me from where I can get more information about file handling and the functions of it..
Reputation Points: 10
Solved Threads: 0
Light Poster
sara khan is offline Offline
33 posts
since Mar 2009
Aug 10th, 2009
0

Re: file handling

Click to Expand / Collapse  Quote originally posted by sara khan ...
can u tell me from where I can get more information about file handling and the functions of it..
Google it! "C++ peek" gives the following as the first link.

http://www.cplusplus.com/reference/i.../istream/peek/

Bookmark the entire site.

http://www.cplusplus.com

It's your first stop before you ask a question on a forum. Type what you are asking about in its search engine. It has all the functions and all the libraries and examples. And a tutorial section.

http://www.cplusplus.com/doc/tutorial/

Bookmark that too.

Scroll down till you get to the "Input/Output With Files" section.

http://www.cplusplus.com/doc/tutorial/files/

If you don't like this site, type "C++ tutorial" into google or Daniweb or wherever. You need to do all of this before posting.
Featured Poster
Reputation Points: 2614
Solved Threads: 687
Posting Expert
VernonDozier is offline Offline
5,375 posts
since Jan 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: AnsiString in Functions
Next Thread in C++ Forum Timeline: I ran out of vector space?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC