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