R
raphfrk
This program should copy one file onto the other. It works if I
compile it with gcc to a cygwin program. However, if I compile it
with the -mno-cygwin option, it doesn't work (this targets native
windows).
Anyway, I just want to check that the program is valid before I see if
I can find a way around a compiler bug.
It might be something simple that I am doing wrong.
-------------------------------------------------------------
#include <stdio.h>
main()
{
FILE *fp;
fp = fopen( "scan0001b.bmp" , "r" );
if( fp == NULL )
{
printf("File open failed for read\n");
exit(0);
}
FILE *fpo;
fpo = fopen( "scanout.bmp" , "w");
if( fpo == NULL )
{
printf("File open failed for write\n");
exit(0);
}
int c=1;
while(!feof(fp))
{
c = fgetc(fp);
if( c>=0 )
fputc( c , fpo );
}
fclose(fp);
fclose(fpo);
}
compile it with gcc to a cygwin program. However, if I compile it
with the -mno-cygwin option, it doesn't work (this targets native
windows).
Anyway, I just want to check that the program is valid before I see if
I can find a way around a compiler bug.
It might be something simple that I am doing wrong.
-------------------------------------------------------------
#include <stdio.h>
main()
{
FILE *fp;
fp = fopen( "scan0001b.bmp" , "r" );
if( fp == NULL )
{
printf("File open failed for read\n");
exit(0);
}
FILE *fpo;
fpo = fopen( "scanout.bmp" , "w");
if( fpo == NULL )
{
printf("File open failed for write\n");
exit(0);
}
int c=1;
while(!feof(fp))
{
c = fgetc(fp);
if( c>=0 )
fputc( c , fpo );
}
fclose(fp);
fclose(fpo);
}