Message-ID: <915C65C50371D11187AD0000F881B9A401858C61@bcarua62.ca.nortel.com> From: "Ian Chapman" To: "'djgpp AT delorie DOT com'" Subject: system Date: Wed, 2 Sep 1998 16:18:13 -0400 MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk Hi all, I've traced a problem using gdb, great tool. I have an int n which is changing when I call:- Junk = system(ren temp.pad blah_blah); here is the code segment. Any help would be greatly appreciated. Regards Ian. void Pad_Sorted_Files(void) { int n; long Junk; // was int and long was no fix. char temp[20]; char *ptr; for(n = 0; n <= 50; ++n) { ptr = &File_Log[n][0]; if(strcmp(ptr, "") == 0) n = 50; // Get out of loop else { in_file = fopen(ptr, "r"); out_file = fopen("temp.pad", "w"); Pad_to_64(); // Pad the file. fclose(in_file); fclose(out_file); strcpy(temp, "del "); strcat(temp, ptr); Junk = system(temp); // del old sorted split file strcpy(temp, "ren temp.pad "); strcat(temp, ptr); // ren temp.pad blah_blah. // *** n = 1 at this point Junk = system(temp); // *** n = 0 here and clobbers the loop. cout << "Padded " << ptr << endl; } } // End for loop } //End of Pad Sorted Files