Re: im facing problem with fread()??



On 24 Aug 2005 03:30:51 -0700,
manoj1978@xxxxxxxxx <manoj1978@xxxxxxxxx> wrote:


>
> Rajshekhar wrote:
>> Hi ,
>> i am writing a simple prgm to read a .txt file then store the contents
>> into the array...
> Please post the contents of triangle.txt.then someone can help you.
> If triangle.txt is a binary file then try rb instead of r in fopen.
>

The way fread() in program is used strongly suggests that the file has
to be binary. A text file is better read using fscanf(), or a combination
of fgets() and sscanf(), or som variant of getc()/getchar().

Villy
.



Relevant Pages

  • Re: binary i/o files
    ... strange characters on the screen. ... I am able to store the values in an ASCII format. ... write press....where pressis the array I am trying to ... write in the binary file. ...
    (comp.lang.fortran)
  • Re: binary i/o files
    ... I am able to store the values in an ASCII format. ... write press....where pressis the array I am trying to ... write in the binary file. ...
    (comp.lang.fortran)
  • RE: pop-up browser persist data back to parent page code-behind
    ... As for the file content, if they're binary file, you can just read out the ... binary content out of the stream and store into a bytearray, then, we ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Insert 3 Gb binary file to oracle blob using Ado.net oracleclient
    ... I was trying to insert 3Gb binary file to oracle 10g BLOB Field using ... The application uses Oracle Transaction. ... After that tried to declare the array using actual no. ... How I can read the 3 GB binary file using .net and store all the bytes ...
    (microsoft.public.dotnet.framework.adonet)
  • im facing problem with fread()??
    ... i am writing a simple prgm to read a .txt file then store the contents ... into the array... ... int buf; ...
    (comp.lang.c)