![]() |
|
#1
|
|||
|
|||
how read a specified line from a filehello!
I'm doing some file i/o programmes for my webpage, but i'm stuck at one prob... i'm working in C i know i can read the whole file(text) with _fgets_ command, but i'd like to read only, i.e. 2nd line, in the file. is that possible? tnx! |
|
#2
|
||||
|
||||
|
Hello galamagalama and welcome to GIDForums.
Unless I am mistaken, fgets should only read up to the newline in a file. Code:
So, fgets should only read one line at a time. So, quickly off the top of my head (and untested... )CPP / C++ / C Code:
If I am thinking right, buffer should contain the text at "lineno" after running that. HTH, d __________________
The best damn Sports Blog period. |
|
#3
|
|||
|
|||
|
weeeeeeeeee, it's working
but only for line one in the file... how could it work for line 2, 3,...etc? |
|
#4
|
|||
|
|||
|
Quote:
nevermind that, i figure it out! many tnx! |
Recent GIDBlog
Writing a book by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CD burner wont burn!! | robertli55 | Computer Hardware Forum | 1 | 18-Jun-2004 11:53 |
| Yet another CD burner problem: Lite-On LSC-24082K | Erwin | Computer Hardware Forum | 1 | 22-May-2004 12:28 |
| Re: Programming Techniques | WaltP | C Programming Language | 0 | 10-Mar-2004 00:56 |
| read specified range of lines from file | etron | C Programming Language | 8 | 18-Feb-2004 09:04 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The