Mail Archives: cygwin/1999/10/28/04:40:19
Chris Faylor wrote:
>
> Well, I guess that shows how things work with Visual C. I think that
> that means that Cygwin can't change it's behavior.
>
> Thanks very much for doing this. Would you mind posting your findings to
> the cygwin mailing list?
>
> -chris
>
> On Wed, Oct 27, 1999 at 10:01:53AM +0200, Pascal Vittone wrote:
> >Chris Faylor wrote:
> >> I'm looking for actual code which demonstrates a behavior under
> >> VC++.
> >>
> >> Can anyone supply this?
> >>
> >>cgf
> >
> > Attached file contains test code. I compiled it with VC++ 6.0 on NT4.0 SP 4. It
> >seems that ctrl-Z is processed as end-of-file for text files.
> >
> > Regards.
> >
> > Pascal
> >
> >--
> > ________________
> >____________________________________________________\ /_______
> >Pascal Vittone ESD/EBU/LSD/R&D
> >mailto:Pascal DOT Vittone AT col DOT bsf DOT alcatel DOT fr Alcatel Business Systems
> >Tel: +33 (0)1 55 66 56 77 54, av. Jean Jaures
> >Fax: +33 (0)1 55 66 54 24 F-92700 Colombes
> >_________________________________________________________\ /____________
The program hereafter displays "End of file" when it reads character ctrl-Z in
myfile.txt. I compiled it with VC++ 6.0 with default libraries. Consequently,
ctrl-Z is processed as end-of-file for text files.
Regards,
Pascal
// ctrlZtest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"
int main(int argc, char* argv[])
{
FILE *pF;
int i;
pF = fopen ("myfile.txt", "w");
for (i = 0; i < 127; i++)
fwrite (& i, 1, 1, pF);
fclose (pF);
pF = fopen ("myfile.txt", "r");
for (i = 0; i < 127; i++)
{
char j;
if (fread (& j, 1, 1, pF) == 0)
{
if (feof (pF))
fprintf (stderr, "End of file\n");
else
fprintf (stderr, "read error\n");
exit (-1);
}
printf ("Value is %d\n", j);
}
return 0;
}
--
________________
____________________________________________________\ /_______
Pascal Vittone ESD/EBU/LSD/R&D
mailto:Pascal DOT Vittone AT col DOT bsf DOT alcatel DOT fr Alcatel Business Systems
Tel: +33 (0)1 55 66 56 77 54, av. Jean Jaures
Fax: +33 (0)1 55 66 54 24 F-92700 Colombes
_________________________________________________________\ /____________
\ /
\/
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
- Raw text -