It is currently Tue Oct 23, 2018 9:12 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: open_() returns always -1
PostPosted: Sat Sep 08, 2018 8:04 pm 
Offline
Addict
Addict

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 3979
Location: Germany
Hi,

I had to use open_() in a PB code.
It was never working. I always got -1 as answer.

Then I imported it by myself and it was working.

Failing:
Code:
ImportC ""
   errno_location() As "__errno_location"
EndImport

#O_RDWR  = $00000002

fd = open_("/tmp/test", #O_RDWR, 0)
If fd > 0
  Debug "open"
  close_(fd)
Else
  Debug "open failed"
  Debug PeekL(errno_location())
EndIf


Working:
Code:
ImportC "/usr/lib/x86_64-linux-gnu/libgc.so.1"
  open.i(path.p-UTF8, flags.i, mode.i)
EndImport

ImportC ""
   errno_location() As "__errno_location"
EndImport


#O_RDWR  = $00000002

fd = open("/tmp/test", #O_RDWR, 0)
If fd > 0
  Debug "open"
  close_(fd)
Else
  Debug "open failed"
  Debug PeekL(errno_location())
EndIf


You have to touch /tmp/test before.

Bernd


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye