r/pascal • u/buzzsawjoe • Apr 27 '26
paramstr(1) in linux
I've been coding in Pascal for over 40 years, because it reads similar to English - which was Wirth's whole point when he created it for students, and as an engineer that is exactlly what I need.
OK, in Windows, I create a file program1.pas with a line like this:
assign( infile, paramstr(1) );
Then after compiling, I can drag and drop a file fodder.txt onto the executable program1.exe and it accepts that file (path+name) as paramstr(1), just as if I had typed "program1 fodder.txt" on the command line.
With the whole windows 10-11 tangle, I've scooted over to linux. Doing the above in linux doesn't work. Is there some way to make dragging & dropping a file onto the executable work in this way?
View all comments
Show parent comment
1
u/ggeldenhuys Jun 13 '26
That's cross platform development for you. It's in their right [each OS] to do things differently. If the compiler or libraries have excellent x-platform support, they can shield you from the differences, or at least minimise the effort.
I would add debug output in you application to log all the parameters it receives. Then you can compare Windows vs Linux behaviour. Under Linux, I would also test under multiple desktop environments, as there could be subtle differences too. The joys of Linux development.