delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/27/13:07:41

Message-ID: <000a01bed853$9eb50060$5085fea9@greedo>
From: "margi" <margi AT club-internet DOT fr>
To: <djgpp AT delorie DOT com>
Subject: ANSI
Date: Tue, 27 Jul 1999 19:14:57 +0200
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
Reply-To: djgpp AT delorie DOT com

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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>/* PRINT_IT.C--permet d'imprimer le =
listings avec=20
les num&#8218;rots de ligne*/<BR>#include &lt;stdlib.h&gt;<BR>#include=20
&lt;stdio.h&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>void do_heading(char =
*filename);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>int line, page;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>main( int argv, char *argc[] =
)<BR>{<BR>char=20
buffer[256];<BR>FILE *fp;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>if( argv &lt;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>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>page =3D 0;<BR>line =3D =
1;<BR>do_heading(=20
argc[1]);</FONT></DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>fprintf( stdprn, "%4d:\t%s, line++, =
buffer=20
);<BR>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>fprintf( stdprn, "\f" =
);<BR>fclose(fp);<BR>return=20
0;<BR>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>void do_heading( char *filename=20
)<BR>{<BR>page++;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>if ( page &gt; 1)<BR>fprintf( stdprn,=20
"\f");</FONT></DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>SO, PLEASE could you say me =
if&nbsp;&nbsp;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>&nbsp;</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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019