Mail Archives: djgpp/1998/09/02/16:21:35
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
- Raw text -