Unix questions - open function

This is Interesting: Free IT Magazines  
Home > Archive > Unix questions > September 2005 > open function





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author open function
hirenshah.05@gmail.com

2005-09-24, 8:49 pm

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.

Ed Morton

2005-09-24, 8:49 pm

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.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com