GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 18-Jul-2006, 06:02
jonas12rena jonas12rena is offline
New Member
 
Join Date: Jul 2006
Posts: 6
jonas12rena is on a distinguished road

File I/O reading a printing any line from a certain file.


Hello, pretty new to programming, my problem is I have to write a program that opens a text file 100 lines long and be able to extract any line of the text file and print it on the screen.

I am able to open the file, and query the user for what line to print but im not sure how to use the getline() function to print it as a string.

If my text file is named work.txt and I want to print line 50 of the text file how would I do this?
  #2  
Old 18-Jul-2006, 11:49
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,245
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all

Re: File I/O reading a printing any line from a certain file.


Read the file until you read line 50. Then output it.
__________________

Age is unimportant -- except in cheese
 
 

Recent GIDBlogWriting a book by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Airport Log program using 3D linked List : problem reading from file batrsau C Programming Language 11 29-Feb-2008 07:44
CD burner wont burn!! robertli55 Computer Hardware Forum 1 18-Jun-2004 10:53
Yet another CD burner problem: Lite-On LSC-24082K Erwin Computer Hardware Forum 1 22-May-2004 11:28
Can't view pages from another machine on the Intranet aevans Apache Web Server Forum 9 14-May-2004 02:26
read specified range of lines from file etron C Programming Language 8 18-Feb-2004 08:04

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 17:02.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.