On 9/13/07, Bachman Kharazmi <[EMAIL PROTECTED]> wrote:
> int main(int argc){
>         int fd,err;
>          char* myString = "helloworld\n";
>         fd = open("rtser0", O_RDWR);
>         printf("fd is %d\n", fd);
>         ioctl(fd, RTSER_RTIOC_SET_CONFIG, &write_config);
>         err=write(fd, myString, strlen(myString));
>         printf("err is %d\n", err);
>         close(fd);
>         return 0;
> }
>
> gives
> sandbox:/home/bkw/code/driver_v4# ./simpledriver_v4
> fd is -1
> err is -1
>
> Which means that fd didn't open the device successfully? :/
> /B

This is POSIX, when a function call returns -1, check errno to see the
failure reason. BTW, you did not check the return value of ioctl.

-- 
                                               Gilles Chanteperdrix

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to