Mail Archives: djgpp/1999/07/27/13:07:41
This is a multi-part message in MIME format.
------=_NextPart_000_0007_01BED864.50900EA0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I'm just learning the c language with a method book, and some of the =
exemple programs just can't be compilated, because of some characters =
like the "\" inthe following program:
/* PRINT_IT.C--permet d'imprimer le listings avec les num,rots de =
ligne*/
#include <stdlib.h>
#include <stdio.h>
void do_heading(char *filename);
int line, page;
main( int argv, char *argc[] )
{
char buffer[256];
FILE *fp;
if( argv <2 )
{
fprint f(stederr, "\nLa syntaxe correcte est: " );
fprintf(stderr, "\n\nPRINT_IT nomfichier.ext\n" );
exit(1);
}
if (( fp =3D fopen( argc[1], "r" )) =3D=3D NULL )
{
fprintf( stderr, "Erreur d'ouverture du fichier, %s!", argc[1]);
exit(1);
}
page =3D 0;
line =3D 1;
do_heading( argc[1]);
while( fgets( buffer, 256, fp ) !=3D NULL )
{
if( line % 55 =3D=3D 0 )
do_heading( argc[1] );
fprintf( stdprn, "%4d:\t%s, line++, buffer );
}
fprintf( stdprn, "\f" );
fclose(fp);
return 0;
}
void do_heading( char *filename )
{
page++;
if ( page > 1)
fprintf( stdprn, "\f");
fprintf( stdprn, "Page: %d, %s\n\n", page, filename );
}
SO, PLEASE could you say me if DJgpp is comformable to the ANSI =
standard?
and if yes, how to solve my problem, thank you
(scuse my english, i'm french:o)
------=_NextPart_000_0007_01BED864.50900EA0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2014.210" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I'm just learning the c language with a =
method=20
book, and some of the exemple programs just can't be compilated, because =
of some=20
characters like the "\" inthe following program:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>/* PRINT_IT.C--permet d'imprimer le =
listings avec=20
les num‚rots de ligne*/<BR>#include <stdlib.h><BR>#include=20
<stdio.h></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>void do_heading(char =
*filename);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>int line, page;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>main( int argv, char *argc[] =
)<BR>{<BR>char=20
buffer[256];<BR>FILE *fp;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>if( argv <2 )<BR>{<BR>fprint =
f(stederr, "\nLa=20
syntaxe correcte est: " );<BR>fprintf(stderr, "\n\nPRINT_IT =
nomfichier.ext\n"=20
);<BR>exit(1);<BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>if (( fp =3D fopen( argc[1], "r" )) =
=3D=3D NULL=20
)<BR>{<BR>fprintf( stderr, "Erreur d'ouverture du fichier, %s!",=20
argc[1]);<BR>exit(1);<BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>page =3D 0;<BR>line =3D =
1;<BR>do_heading(=20
argc[1]);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>while( fgets( buffer, 256, fp ) !=3D =
NULL=20
)<BR>{<BR>if( line % 55 =3D=3D 0 )<BR>do_heading( argc[1] =
);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>fprintf( stdprn, "%4d:\t%s, line++, =
buffer=20
);<BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>fprintf( stdprn, "\f" =
);<BR>fclose(fp);<BR>return=20
0;<BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>void do_heading( char *filename=20
)<BR>{<BR>page++;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>if ( page > 1)<BR>fprintf( stdprn,=20
"\f");</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>fprintf( stdprn, "Page: %d, %s\n\n", =
page, filename=20
);<BR>}<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>SO, PLEASE could you say me =
if DJgpp is=20
comformable to the ANSI standard?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>and if yes, how to solve my problem, =
thank=20
you</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>(scuse my english, i'm=20
french:o)</FONT></DIV></BODY></HTML>
------=_NextPart_000_0007_01BED864.50900EA0--
- Raw text -