Re: read multiple lines of a file



On Mon, 30 May 2005 16:50:49 +0000 (UTC),
chitlesh@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx (Clunixchit) wrote:

>How can i read lines of a file and place each line read in an array?
>for exemple;
>array[0]=line1
>array[1]=line2

Your use of the word line implies a text file. fgets() is frequently
the tool of choice.

If the file is not a text file, then fread() would probably be better.



<<Remove the del for email>>
.



Relevant Pages

  • Re: if ($title == ) question
    ... "Daedalus" wrote in message ... > returning the result to an array $bits ... > of each word uppercase ... > Exemple (if the test succeed. ...
    (alt.php)
  • How does Hpricot ... inner_text work?
    ... The documentation for inner_text implies it occupies the Hpricot::Elements array. ...
    (comp.lang.ruby)
  • [task] i need some reference...
    ... i'm start to work on Ada task. ... i need exemple of schedulers. ... my idea is to write a simple task_manager with a array of 3 or 4 ...
    (comp.lang.ada)
  • Error code and regional setting
    ... Exemple: ... These errors messages have to be translated in several languages ... An array by ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: C++ Bounds Checking
    ... Check array subscripts only. ... Outputs code to do a quick check on array bounds. ... Implies /CHECK and also causes code to be planted in order to do run-time ... redirecting output with a dos prompt. ...
    (comp.lang.fortran)