![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Script required to get a required info from file. Pls. help me. | ntgobinath | Shell Programming and Scripting | 2 | 05-31-2008 09:34 AM |
| Help required on awk | meetavin | Shell Programming and Scripting | 3 | 04-18-2008 10:47 AM |
| SSL help required | binums | HP-UX | 0 | 05-04-2006 03:03 AM |
| Help required on DBX | Sumanth | SUN Solaris | 1 | 07-29-2004 10:54 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
help required
hi i am new to c programming and found this on the net could someone tell me what it actually does, many thanks in advance cheers
#include <fcntl.h> main() { int fd; fd = open("in1", O_RDONLY); printf("%d\n", fd); } and this too please #include <fcntl.h> main() { int fd; fd = open("in1", O_WRONLY); if(fd < 0) { perror("filename"); exit(1); } } |
|
||||
|
First one: open file "in1" read-only and print out the file descriptor (file handle)
Second: open file "in1" write-only and if open() returns a negative number (like -1) that means it cannot be open()ed. Show error message and quit. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|