delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/27/14:25:02

Message-ID: <CD4DE0181670D211AC5400A0C94BD1B812073F@dksmsx30.idk.intel.com>
From: "Alstrup, Kurt" <kurt DOT alstrup AT intel DOT com>
To: "'djgpp AT delorie DOT com'" <djgpp AT delorie DOT com>
Subject: RE: ANSI
Date: Tue, 27 Jul 1999 11:24:33 -0700
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2448.0)
Reply-To: djgpp AT delorie DOT com

If the your program is reproduced correct in your mail, then you miss a
quote in a printf and you end up having the content of the next string
(starting with a \) interpreted as code. To my knowledge djgpp is as close
to ANSI as you can come using a GNU compiler.
 
Regards,
Kurt Alstrup

-----Original Message-----
From: margi [ mailto:margi AT club-internet DOT fr <mailto:margi AT club-internet DOT fr>
]
Sent: Tuesday, July 27, 1999 10:15 AM
To: djgpp AT delorie DOT com <mailto:djgpp AT delorie DOT com> 
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 );
<here is the error>                    
 }
 
fprintf( stdprn, "\f" ); 
<and here is the backslash the compiler sees>  
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 -


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