Message-Id: <199801220709.UAA24275@fep1-orange.clear.net.nz> From: "Jamie Love" To: "DJGPP mailing list" Subject: whats wromg with my file program? - HELP! Date: Fri, 23 Jan 1998 08:11:57 +1300 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Precedence: bulk Not specifically a djgpp question, but it does happen to involve the djgpp.env file So, can anyone tell my why, when I compile and run the binary with the following command line: (the sprites.set is certainly a real file) remdefs sprites.set I get the djgpp.env file!!! instead of the correct sprites.set file. BTW I run this under dos. #include #include #include #include int main(int argc, char *argv[]) { char *data; int length; FILE *inFile; printf("Silicon Wanderers remove defines program from .set files.\n" "Programmed 22 Jan 1998 by Jamie Love.\n" "Opening %s\n", argv[1]); /*in case the user does not know how to do it*/ if(argc != 2) { printf("Usage 'remdefs file.set'"); return 0; } inFile = fopen(argv[1], "r"); if(inFile == NULL) { printf("Error: unable to open %s", argv[1]); return 0; } fseek(inFile, 0, SEEK_END); length = ftell(inFile); data = malloc(length); *(data + length) = 0; if(data == NULL) { printf("Error: unable to malloc %d bytes of memory for buffer", length); return 0; } fseek(inFile, 0, SEEK_SET); if((length = fread(data, 1, length, inFile)) != -1) { printf("Error: unable to read %d bytes from %s", length, argv[1]); return 0; } printf("%s\n", data); getch(); fclose(inFile); return 1; } Jamie Love Part of the Silicon Wanderers (http://www.geocities.com/SiliconValley/Horizon/4532) e-mail me at jamie DOT love AT clear DOT net DOT nz