User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 455,962 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,602 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 846 | Replies: 1
Reply
Join Date: Nov 2007
Posts: 15
Reputation: dsuh06 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
dsuh06 dsuh06 is offline Offline
Newbie Poster

infile.peek function

  #1  
Nov 20th, 2007
Hello, I am trying to "peek" the next character to see if it is a character. If the word exceeds the max linelength it should be written in the next line with the count starting from zero again.

for example:
if the max line length is 10,

The max
length is
10.

rather than

The max le
ngth is 10

is this the correct if function?
  1. if (current >= linelength)
  2. {
  3. char a;
  4. if(isalpha(infile.peek()))
  5. {
  6. outfile.put('\n');
  7. count = 0;
  8. }
  9. else
  10. outfile.put(current);
  11. count++;
  12. }
thank you!
Last edited by cscgal : Nov 20th, 2007 at 6:17 am. Reason: Added code tags.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2006
Location: ★ ijug.net ★
Posts: 1,012
Reputation: ithelp will become famous soon enough ithelp will become famous soon enough 
Rep Power: 6
Solved Threads: 68
ithelp ithelp is offline Offline
Veteran Poster

Re: infile.peek function

  #2  
Nov 20th, 2007
Use
if(count >= linelength)
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 8:59 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC