[fpc-pascal] how to catch fpopen() output

Graeme Geldenhuys graemeg.lists at gmail.com
Wed Jul 23 14:40:34 CEST 2008


Hi,

I have a function called fpgOpenURL(...) which contains the following ....

    if fpsystem('which xdg-open') = 0 then
      Helper := 'xdg-open'
    else if fpsystem('which firefox') = 0 then
      Helper := 'firefox';
    else if fpsystem('which konqueror') = 0 then
      Helper := 'konqueror';
    else if fpsystem('which opera') = 0 then
      Helper := 'opera';
    else if fpsystem('which mozilla') = 0 then
       Helper := 'mozilla';

It tries to dected the preferred or installed web browser. If Helper
<> '' at the end, I know I found a web browser.  But how do I catch
the output of fpopen('which xxx') so that I can set the full path of
the application in  the 'Helper' variable.

eg:
   instead of using 'xdg-open'  I would prefer to set the full path
returned by 'which xdg-open' which is '/usr/bin/xdg-open'


Regards,
 - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-pascal mailing list