Created
October 6, 2022 15:09
-
-
Save microhobby/2e0221e8c6e677d505d183c59064508a to your computer and use it in GitHub Desktop.
Testing getting errno with Gambas3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <gpiod.h> | |
#include <errno.h> | |
int main(int argc, char *argv[]) | |
{ | |
struct gpiod_chip *chip; | |
int ret; | |
chip = gpiod_chip_open_by_number(0); | |
ret = errno; | |
printf("Errno :: %d\n", ret); | |
if (!chip) { | |
return ret; | |
} | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' Gambas module file | |
Library "libgpiod:2" | |
Extern gpiod_version_string() As String In "libgpiod:2" | |
Extern gpiod_chip_open_by_number(chip As Integer) As Pointer In "libgpiod:2" | |
Public Sub Main() | |
Dim chip As Pointer | |
Dim ret As Integer | |
chip = gpiod_chip_open_by_number(0) | |
ret = System.Error | |
Print "Errno :: " & ret | |
If IsNull(chip) Then | |
Quit ret | |
Endif | |
Quit 0 | |
End |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment