Thanks to both of you (Joe and Malcom Smith).

I just found the answer at declaresub.com. You use the following
declare, which gets you a pointer to errno, which you then use as a
memoryblock to get the error code.

    soft declare function libcErrorCode lib LibraryPath alias
"__errno_location" () as Ptr
   
The site also has a nice function for getting the messages using
strerror.

Paul Dobbs
Software Engineer, Staff 
Lockheed Martin Missiles and Fire Control
Phone (972) 603-1244
Fax (972) 603-2017

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Tuesday, March 06, 2007 2:37 PM
To: [email protected]
Subject: Re: errno

On Mar 06, 2007, at 20:09 UTC, Dobbs, Paul wrote:

> I'm trying to call a unix function (shmget) from RB. I seem to have 
> gotten the declare right, or at least partly right, but I'm getting a 
> return value of -1, which is an error. The error number is supposed to

> be in errno. How do I get errno and find out what the error is?

errno is a global variable and not something you can access directly in
RB, but you can declare to the perror() subroutine, which will read
errno and stuff a description of its meaning into the string you give
it.  (See "man perror" for details.)

Best,
- Joe


--
Joe Strout -- [EMAIL PROTECTED]
Verified Express, LLC     "Making the Internet a Better Place"
http://www.verex.com/

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

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
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