B
Bill Cunningham
I have written this file and decided to try error checking and eof
checking and there must be a bug somewhere. It compiled with djgpp fine. It
takes the win32/pe assembler as.exe and writes it to a.exe. I hope it's not
too hard to read. I'm stumped but that's expected and nothing new.
#include <stdio.h>
#include <stdlib.h>
main(){
char buf [2048];
FILE *fp;
fp=fopen("as.exe","rb");
if (fread(buf,sizeof(char),2048,fp)!=2048)
{if (ferror(fp))
{fprintf(stderr,"File error"); exit(1);}
if (feof(fp)) {fprintf(stderr,"EOF error"); exit (1);}}
fclose(fp);
fp=fopen("a.exe","wb");
fwrite(buf,sizeof(char),2048,fp);
fclose(fp);}
stdlib.h for exit()
Bill
checking and there must be a bug somewhere. It compiled with djgpp fine. It
takes the win32/pe assembler as.exe and writes it to a.exe. I hope it's not
too hard to read. I'm stumped but that's expected and nothing new.
#include <stdio.h>
#include <stdlib.h>
main(){
char buf [2048];
FILE *fp;
fp=fopen("as.exe","rb");
if (fread(buf,sizeof(char),2048,fp)!=2048)
{if (ferror(fp))
{fprintf(stderr,"File error"); exit(1);}
if (feof(fp)) {fprintf(stderr,"EOF error"); exit (1);}}
fclose(fp);
fp=fopen("a.exe","wb");
fwrite(buf,sizeof(char),2048,fp);
fclose(fp);}
stdlib.h for exit()
Bill