Forum > Other OS
MSDOS Arguments
Coldfire:
Hi, i'm trying to port a very short programfrom linux to MSDOS-8086.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program project1;Uses sysutils;var arginput : string; argoutput : string; fileinput : file; fileoutput : text; dumpbuf : word; resultado : integer; begin arginput:=ParamStr(1); argoutput:=ParamStr(2); assign(fileinput,arginput); assign(fileoutput,argoutput); reset(fileinput,2); rewrite(fileoutput); write(fileoutput,'<nombrevariable> dw '); blockread(fileinput, dumpbuf, 2, resultado); write(fileoutput, '0', format('%x',[dumpbuf]),'h'); while(eof(fileinput)=false) do begin blockread(fileinput, dumpbuf, 2, resultado); write(fileoutput, ', 0', format('%x',[dumpbuf]),'h'); end; close(fileinput); close(fileoutput); writeln(resultado);end.in linux works somewhat great(dumps a file into little endian words written in a text file), but it behaves strange in MSDOS. Apparently is ignoring arguments. Also it expects a CRLF from keyboard to finish. MSDOS arguments have limitations?
Thanks
marcov:
The eof() is for cooked I/O not blockread.
EOF with blockread is when resultado<> the number of bytes read (mostly 2 in your case)
So the Linux program is wrong, and might only happen to work by chance
Ñuño_Martínez:
Also note that Linux will expand filename wildcards (i.e. "file*", "file??" ...). Neither MS-DOS or Windows does it. I don't know about others.
Coldfire:
--- Quote from: marcov on June 02, 2017, 10:01:35 am ---The eof() is for cooked I/O not blockread.
EOF with blockread is when resultado<> the number of bytes read (mostly 2 in your case)
So the Linux program is wrong, and might only happen to work by chance
--- End quote ---
good point. Now that is fixed, linux version works ok, but DOS version is still printing the file to stdout instead of specified file, and still waits for a CRLF from keyboard...
marcov:
Start with using reset(f,1);
Navigation
[0] Message Index
[#] Next page