On Mar 9, 2007, at 6:30 PM, Tim Jones wrote:

> On Mar 9, 2007, at 2:22 PM, Charles Yeomans wrote:
>
>> On Mar 9, 2007, at 3:53 PM, Tim Jones wrote:
>>
>>> On Mar 9, 2007, at 1:41 PM, Charles Yeomans wrote:
>>>>>>> FILE * popen(const char *command, const char *type);
>>
>> Looking at fread, I'm not sure what the problem is; popen returns a
>> FILE*, and fread wants a FILE*.  So all you need to do is to pass the
>> value returned from popen (unless it's null, of course) to fread or
>> fwrite and have at it.
>
> I guess my issue is the creation of the declare.  How should the FILE
> return be defined?
>
> Soft Declare Function popen Lib "/usr/lib/libc.dylib" (cmd As  
> CString, \
>       mode As CString) As Ptr
>
> Then, how do I deal with that returned value?

Soft Declare Function popen Lib "System.framework" (cmd As CString, \
        mode As CString) As Integer


Store it as an Integer, and declare subsequent functions to take an  
Integer parameter as appropriate.  In general, for functions that  
return a pointer type, I just declare it as Integer unless I need to  
do something different.  That habit may be a little out of date,  
though; the Ptr datatype now appears to work equally well in this  
sort of case.

Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to