My file is a textfile and contains around 300 lines . It is in a linux
machine and I am reading the file using fread() rather than using fgets
because when I use fgets() , the new line character is added. So when I
try to open it in Windows95 I am getting rubbish. Can u guide me to
convert the linux text file before I read it in Windows95.
thanks in advance...
On Wed, 24 Jun 1998, Glynn Clements wrote:
>
> Balan Sinniah wrote:
>
> > I am writing a simple socket pogramming where I am using 2 different
> > operating system, Linux and Windows95. I am sending a file from Windows95
> > to linux and vice versa. The program written in C for linux using
> > fread() function to read line by line from a given file and the program
> > receive a different file from windows95 (Visual Basic) and store it in a
> > buffer before write it in a file. When I try to write the buffer in a
> > file, it is not written as it should be ..I mean it is not written
> > line by line but everything in one line..These happen in windows95
> > too.. Please guide me...
>
> I think that you'll need to provide more details.
>
> If you want to read/write data a line at a time, then you will
> probably want to use fgets/fputs, unless the data contains NUL
> characters.
>
> Also, if the file is a text file, you need to decide whether you're
> going to translate between Unix (LF) and DOS/Windows (CR LF)
> end-of-line conventions. If you try to read a Unix text file on a
> DOS/Windows system without converting it, you may run into problems
> (WordPad/Write will handle it OK, NotePad won't).
>
> --
> Glynn Clements <[EMAIL PROTECTED]>
>