Re: open function

From: Ed Morton (morton_at_lsupcaemnt.com)
Date: 09/25/05


Date: Sat, 24 Sep 2005 20:24:50 -0500

hirenshah.05@gmail.com wrote:
> i am using open function to create a file. when i run the program for
> first time , it returns positive value. but when i run my program
> another time it is returning -1 (error).
>
> fd=open(path,O_CREAT|O_TRUNC|O_RDWR);
>
> fd = -1
>
> can anuone suggest how can i remove this bug.
>

If open() fails, it sets errno. Dump that and see what it's telling you.

        Ed.



Relevant Pages

  • Re: open function hang on MacOS 10.5.1
    ... I used open function to open bluetooth port on MacOS 10.5.1. ... Note:: Same thing works on MacOS 10.4(it's return success or failed) ... first time it open successfully .. ...
    (comp.sys.mac.programmer.help)
  • open function
    ... i am using open function to create a file. ... first time, it returns positive value. ... can anuone suggest how can i remove this bug. ...
    (comp.unix.questions)