I'm using dev-c++ version 4.9.9.2, but the same problem occurs with the stable version.
If I delete a blank line of the code, the program fails to work as it should.
With the following section:
strcpy( achPath, psDir );
strcat( achPath, "\" );
strcpy( achSrch, achPath );
strcat( achSrch, psPatt );
the program runs fine:
F:\Ls>ls_good -s "*.exe"
Ls_bad.exe
Ls_good.exe
x\xx\xxx\x.exe
y\x.exe
but if I delete the blank line:
strcpy( achPath, psDir );
strcat( achPath, "\" );
strcpy( achSrch, achPath );
strcat( achSrch, psPatt );
the program fails:
F:\Ls>ls_bad -s "*.exe"
Ls_good.exe
Ls_bad.exe
Ls.exe
Gms.
Zip with devcpp-ini, c and exe files, a diff file, and test folders
Logged In: NO
Sorry, I forgot...
Windows 98 SE
Compaq computer:
AuthenticAMD / AMD-K6 3D processor / 88 MB RAM
The compiler log says (in both cases):
Compiler: Default compiler
Done.
Gms.
Logged In: NO
Problem solved!!
The issue here was that the line previous to the blank line had a double slash remark (which I omitted in the example for briefness sake) that ended in a backslash:
strcpy( achPath, psDir ); // dir\subir
strcat( achPath, "\" ); // dir\subdir\
Then, the real problem seems to be that the compiler does not really ignore what comes after the double slash.
In this case, the construct "/ ... /" must be used.
Gms.