Forum > Other OS
MSDOS Arguments
Coldfire:
using reset(f,2) and hardcoding file name, it works. However
--- 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";}};} ---write(fileoutput,'<nombrevariable> dw ');
fileoutput is null :o. i print it manually
--- 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";}};} ---arginput:=ParamStr(1); argoutput:=ParamStr(2); writeln(arginput);
but does not print nothing (well, prints a CRLF from writeln)
marcov:
Call paramstr() for numbers higher than paramcount is illegal.
Bart:
--- Quote from: marcov on June 02, 2017, 06:39:47 pm ---Call paramstr() for numbers higher than paramcount is illegal.
--- End quote ---
Huh?
ParamStr(ParamCount+n), where n>0, simply has to return an empty string (see: http://docwiki.embarcadero.com/Libraries/Tokyo/en/System.ParamStr). It's not illegal, it's maybe a little foolish though.
Bart
marcov:
--- Quote from: Bart on June 02, 2017, 06:46:51 pm ---
--- Quote from: marcov on June 02, 2017, 06:39:47 pm ---Call paramstr() for numbers higher than paramcount is illegal.
--- End quote ---
Huh?
ParamStr(ParamCount+n), where n>0, simply has to return an empty string (see: http://docwiki.embarcadero.com/Libraries/Tokyo/en/System.ParamStr). It's not illegal, it's maybe a little foolish though.
Bart
--- End quote ---
Params* are overriden in objpas, so the Object Pascal case might be different from the fpc case.
Though that is not why I was wrong, it is just defensive programming from the early days I guess.
Coldfire:
writeln(paramcount);
writes 1 when i put in console ">:/project1 a"
but writeln(paramstr(1)); just prints a CRLF
now code goes in this
--- 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, dos;var arginput : string; argoutput : string; fileinput : file; fileoutput : text; dumpbuf : word; resultado : integer; begin writeln(paramcount); //arginput:=ParamStr(1); //argoutput:=ParamStr(2); writeln(paramstr(1)); assign(fileinput,'input.ans'); assign(fileoutput,'output.ans'); reset(fileinput,2); reset(fileoutput); rewrite(fileoutput); write(fileoutput,'<nombrevariable> dw '); blockread(fileinput, dumpbuf, 1, resultado); write(fileoutput, '0', format('%x',[dumpbuf]),'h'); while(resultado=1) do begin blockread(fileinput, dumpbuf, 1, resultado); write(fileoutput, ', 0', format('%x',[dumpbuf]),'h'); end; close(fileinput); close(fileoutput); //writeln(resultado);
Navigation
[0] Message Index
[#] Next page
[*] Previous page