[Solved] Output of fpReadLink lazarus / 66-Unix ---------------------------------------------------------------------- Fred vS · 2022-09-03 00:20 Hello. With this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program fpreadlink_test;  uses    baseunix;  var    pathexec : string;           begin      Fpreadlink('/proc/self/exe',@pathexec[0],high(pathexec));      writeln(pathexec);  end. I get this: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ~> ./fpreadlink_test home/fred/fpreadlink_test OK, it works, also if a symlink -s was used. But why is the first "/" before "home" missing in the output ? (Or I miss something.  ) Fre;D ---------------------------------------------------------------------- Fred vS · 2022-09-03 01:24 OK, found solution thanks to /fpcsrc/3.2.2/rtl/linux/system.pp and his SysInitExecPath procedure. So this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   Program fpreadlink_test;    uses      baseunix;    var      pathexec : shortstring;        i : integer;          begin      pathexec[0]:=#0;      i := Fpreadlink('/proc/self/exe',@pathexec[1],high(pathexec));    if (i>0) and (pathexec[1]='/') then pathexec[0]:=char(i);           writeln(pathexec);    end. Gives this (with the "/" at begin):  Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ~> ./fpreadlink_test/home/fred/fpreadlink_test   ( and sorry for the noise) Fre;D ---------------------------------------------------------------------- Fred vS · 2022-09-03 11:41 Even simpler: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Program fpreadlink_test;   uses     baseunix;   var     pathexec : shortstring;        begin    pathexec := Fpreadlink('/proc/self/exe');    writeln(pathexec);  end.