Unresolved warning - QuickC V1.1

haggas at kean.ucs.mun.ca haggas at kean.ucs.mun.ca
Mon Oct 22 22:12:15 AEST 1990


What is the cause of the warning in the indicated line?
/* sysread.c */
/* reads and displays file - uses system I/O */
#include<fnctl.h>	/* needed for oflags in open() */
#include<stdlib.h>	/* exit() */
#include<conio.h>	/* putch() */
#include<io.h>		/* read() */
#define		BUFFSIZE	512
char buff[BUFFSIZE];	/* buffer */
void main(int, char *[]);	/* prototype for main() */

void main(argc,argv)
int argc;
char *argv[];
{
   int inhandle, bytes, j;
   if( argc != 2 )		/* check arguments */
      { printf("Format: C>sysread file.xxx"); exit(1); }
/* open file */
/* The following line has the C4051 warning - Data Conversion. Why? */
   if( (inhandle = open(argv[1], O_RDONLY | O_BINARY)) < 0 )
      { printf("Can't open file %s.", argv[1]); exit(1); }
/* read one buffer */
   while( (bytes = read(inhandle, buff, BUFFSIZE)) > 0 )
      for(j=0; j<bytes; j++)	/* print buffer */
         putch(buff[j]);
   close(inhandle);		/* close file */
}
I have tried typecasting: the value of open(), argv[1], and the constants:
O_RDONLY and O_BINARY to no avail. I have tried including the header files:
sys\types.h and sys\stat.h, to no avail. I must also point out that this
warning occurs only with QuickC and not with the Micorsoft Optimizing 
Compiler. And last but not least, this program does work!



More information about the Comp.lang.c mailing list