Mail Archives: djgpp/1999/07/27/16:03:22
Ok,
line 36: missing end quote
fprintf( stdprn, "%4d:\t%s, line++, buffer );
should be:
fprintf( stdprn, "%4d:\t%s", line++, buffer );
line 16: fprint undeclared
fprint f(stederr, "\nLa syntaxe correcte est: " );
should be
fprintf(stederr, "\nLa syntaxe correcte est: " );
(fprint f should be fprintf - no space)
and finally
line 16: stederr undeclared
fprintf(stederr, "\nLa syntaxe correcte est: " );
should be
fprintf(stderr, "\nLa syntaxe correcte est: " );
(stederr should be stderr - no extra 'e')
After all that I was able to successfully compile print_it.c using:
gcc print_it.c -o print_it.exe
I did not test the program to see if it actually prints anything because I
don't have a printer and I didn't take the time to try to figure out how to
redirect stdprn.
-Brian
-----Original Message-----
From: margi <margi AT club-internet DOT fr>
To: djgpp AT delorie DOT com <djgpp AT delorie DOT com>
Date: Tuesday, July 27, 1999 12:15 PM
Subject: ANSI
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 = fopen( argc[1], "r" )) == NULL )
{
fprintf( stderr, "Erreur d'ouverture du fichier, %s!", argc[1]);
exit(1);
}
page = 0;
line = 1;
do_heading( argc[1]);
while( fgets( buffer, 256, fp ) != NULL )
{
if( line % 55 == 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)
- Raw text -