[fpc-pascal] DOS find

DONALD PEDDER jims_son at jedi.apana.org.au
Fri Feb 3 07:19:48 CET 2006


    I'm having issues with the following 2 lines of code...

Exec(GetEnv('COMSPEC'),'/c find "'+paramstr(1)+'" qbslist.txt');
writeln('return code ',lo(DosExitCode));

    Even when nothing is found I still get return code 0! :-\ I need to 
know how many strings were found (or at a minimum if none were found, 
which should theoretically have a non-zero return code. I know it does 
in NT, but at home in DR-DOS/MS-DOS "echo %errorlevel%" isn't working, so 
I can't see directly what return code it's giving, though I'm pretty 
sure it wouldn't be 0 if nothing was found).

    Ideally I'd rather let FP do the search (so that the code isn't 
OS-dependent - one day, when I get around to it, I'd like to compile this 
for Unix too), but I can't find anything like that. In the documentation I 
can find stuff for string manipulations, and stuff for file manipulations, 
but nothing for finding a string in a set of files. :-\

    I'm using 1.0.10 (seeing as how 2.0.0 doesn't support DOS from the 
comments I've seen on list).

thanks,
    DONALD.

BIG DON's Home-page  - http://jedi.apana.org.au/~jims_son
Pedder Passer Rating - http://jedi.apana.org.au/~jims_son/PPR
AusNFL mailing-list  - http://jedi.apana.org.au/mailman/listinfo/ausnfl

"What I always wanted is to be accepted, not understood" - MAN RAY



More information about the fpc-pascal mailing list