Hi maTTse,
Don't worry, normally you will not be confronted with such mysterious FreeBasic bugs. Overall it's a well-constructed language, but in rare occasions we stumble over such behaviour... bad luck.
As to your desire to grab the output: the Open Pipe example is the way to go. It is slightly more verbose than Launch$(), but it's not really complicated. Just try it.
jj2007 wrote:Besides, without the BOM the code compiles with fbc64.exe -gen gcc -Wc -O2 -s console (FreeBASIC Compiler - Version 1.07.1 (2019-09-27), built for win64 (64bit)) but crashes with an exception; the debugger shows that rbp has a strange value. The crash happens in the line sh=pipeout("echo "+"%"+g(1)+"%"); the following line env=environ(g(1)) crashes, too.
I investigated the problem in the debugger, and found that g(1) is the culprit (with Fbc64 only!). Here is test code:
Code: Select all
Dim as string myecho
Print "A: ";StrPtr(myecho)
myecho="echo "+"%"+g(1)+"%"
Print "B: ";StrPtr(myecho)
sh=pipeout(myecho)
Print "C: ";sh