TSS has nothing to do with strings. TSS = Task Segment Selector. It's a structure used by the intel cpus in protected mode. The message "invalid TSS" is probably printed by the DPMI host. (usually cwsdpmi.exe, if you are using plain DOS and not a Windows DOS box.) Probably means that you messed things up in memory, which can happen quite often when using pointers and C-style "strings", etc...Below is the current state of my code. I am getting "invalid TSS" at the point I have noted. I don't even know what a "TSS" is! I guess it's something to do with strings (I haven't used strings much before either - something else lacking in my previous compilers). I searched the doco, but couldn't find what I was looking for.
Exec(GetEnv('COMSPEC'),'/c dir test*'); tempstr1:='/c copy'; tempstr2:=' '; tempstr:=strcat(tempstr1,tempstr2); writeln(tempstr,'*'); tempstr1:=tempstr; tempstr2:=argv[1]; tempstr:=strcat(tempstr1,tempstr2); writeln(tempstr,'*'); tempstr1:=tempstr; < program tempstr2:=' '; < crashes tempstr:=strcat(tempstr1,tempstr2); < here writeln(tempstr,'*'); tempstr1:=tempstr; tempstr2:=argv[1]; tempstr:=strcat(tempstr1,tempstr2); writeln(tempstr,'*'); tempstr1:=tempstr; tempstr2:='.bak /v'; tempstr:=strcat(tempstr1,tempstr2); writeln(tempstr,'*'); Exec(GetEnv('COMSPEC'),tempstr); Exec(GetEnv('COMSPEC'),'/c dir test*');
How about 1 line of code :-) Exec(GetEnv('COMSPEC'), '/c copy '+ParamStr(1)+' '+ParamStr(1)+'.bak /v');
There's no need to even use Pascal for this kind of thing. You could use a .bat file:
copy %1 %1.bak /v
_______________________________________________ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal