Post by george on Feb 8, 2009 10:43:19 GMT -5
hello
this is a classic question in all forums.
sorry for my slow activity because of some health problems.
here is a plugin to call console prgram and gets it's output
i have used the DJLinux FreeBASIC_Basic4GL_PLugin_SDK
basic4gl.proboards20.com/index.cgi?board=dllpc&action=display&thread=1972
, and his recent explanations about passing strings in the above page also.
freebasic have a way to capture the output of external program without making a temporary file, (i think so, i'm not absolutely sure)
look at the part of the attached program callFactor.bas
ProgramName = *b
dim text as string
dim inpline as string
OPEN PIPE ProgramName for input as #1
do while( not eof(1 ) )
line input #1, inpline
text = text + inpline + chr$(13) + chr$(10)
loop
close #1
i get the idea from the freebasic examples:
fbc.cvs.sourceforge.net/fbc/FreeBASIC/examples/file/filepipe.bas?revision=1.3&view=markup
the callFactor.gb is for calling a console Factor.exe program for factorizing big numbers , the code is:
dim b$,c$
b$="factor.exe 123456789123456789123456789123"
c$=RunProgram(b$)
printr c$
the big number is the paramiter for factor.exe, you can write any other string such as b$="Dir *.*"
copy the attached plugin "callFactor.dll" to Basic4GL directory and run the callFactor.gb
indeed you will disappointed by the output since the original string returned by freebasic have a newline characters, but seems that basic4gl does not print those chars. i need to read more in the forum about basic4gl way of displaying text on the screen,
the output screen in basic4gl:

the output screen by writing factor 123456789123456789123456789123 from the dos prompt:

note that in that the prime numbers are the ones which follow the words: PRIME FACTOR.
i hope i will organise the output by code in another version.
download the Plugin from:
sites.google.com/site/tallulahorg/Home/run_factor.rar
notes:
the factor.exe from :http://www.shamus.ie/index.php?page=Other-Features
another note: if the number you enter are very big and belong to the hard problem of mathematics ie: may contain two big prime numbers then you can't stop the factor.exe but by ctrl+alt+del several times, the authors does not implements the Do Events capabilities for the sake of speed, any way in despited this, it is a very good program,
regards
this is a classic question in all forums.
sorry for my slow activity because of some health problems.
here is a plugin to call console prgram and gets it's output
i have used the DJLinux FreeBASIC_Basic4GL_PLugin_SDK
basic4gl.proboards20.com/index.cgi?board=dllpc&action=display&thread=1972
, and his recent explanations about passing strings in the above page also.
freebasic have a way to capture the output of external program without making a temporary file, (i think so, i'm not absolutely sure)
look at the part of the attached program callFactor.bas
ProgramName = *b
dim text as string
dim inpline as string
OPEN PIPE ProgramName for input as #1
do while( not eof(1 ) )
line input #1, inpline
text = text + inpline + chr$(13) + chr$(10)
loop
close #1
i get the idea from the freebasic examples:
fbc.cvs.sourceforge.net/fbc/FreeBASIC/examples/file/filepipe.bas?revision=1.3&view=markup
the callFactor.gb is for calling a console Factor.exe program for factorizing big numbers , the code is:
dim b$,c$
b$="factor.exe 123456789123456789123456789123"
c$=RunProgram(b$)
printr c$
the big number is the paramiter for factor.exe, you can write any other string such as b$="Dir *.*"
copy the attached plugin "callFactor.dll" to Basic4GL directory and run the callFactor.gb
indeed you will disappointed by the output since the original string returned by freebasic have a newline characters, but seems that basic4gl does not print those chars. i need to read more in the forum about basic4gl way of displaying text on the screen,
the output screen in basic4gl:
the output screen by writing factor 123456789123456789123456789123 from the dos prompt:
note that in that the prime numbers are the ones which follow the words: PRIME FACTOR.
i hope i will organise the output by code in another version.
download the Plugin from:
sites.google.com/site/tallulahorg/Home/run_factor.rar
notes:
the factor.exe from :http://www.shamus.ie/index.php?page=Other-Features
another note: if the number you enter are very big and belong to the hard problem of mathematics ie: may contain two big prime numbers then you can't stop the factor.exe but by ctrl+alt+del several times, the authors does not implements the Do Events capabilities for the sake of speed, any way in despited this, it is a very good program,
regards