![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| c system call | rangaswamy | High Level Programming | 1 | 02-19-2008 10:53 AM |
| how to differentiate system call from library call | muru | UNIX for Advanced & Expert Users | 2 | 07-19-2007 08:20 PM |
| a system call for sed in a awk script | seaten | UNIX for Dummies Questions & Answers | 6 | 05-20-2005 07:17 AM |
| any system call in unix to access ip routing table | vinodkumar | IP Networking | 1 | 04-21-2005 08:56 AM |
| Need help to access/mount so to access folder/files on a Remote System using Linux OS | S.Vishwanath | UNIX for Dummies Questions & Answers | 2 | 07-30-2001 05:17 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
Is it possible to check the Existence/read/write of stdin,stdout,stderr using access() call like for the files we do. Ex: fd=access("./hi.txt",F_OK) Similarly I wanna check stdin/tdout/stderr using access() call I tried using fd=access(stdout,F_OK); But the result is -1. I believe I did some error in writing it. Will you please suggest the correct way? Also one more doubt with access() call. Is it True that the standard file desc of STDIN,STDOUT and STDERR are 0,1,2 respectively? Thanks, Ramkrix |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
First off, how did that ever compile, should be:
Code:
fd=access(fileno(stdout),F_OK); |
|
#3
|
||||
|
||||
|
access() requires a path, not an fd, for the first argument. The closest equivalent for an fd that I can think of is an fcntl with a command of F_GETFD or maybe F_GETFL. I would try those. Remember that a valid fd may not refer to a disk file at all. It could be a socket or something like that.
|
|
#4
|
|||
|
|||
|
Hi Perdebo,
then how can we make access() sys call work with stdin, stdout, stderr. Jim, I tried your way, but it did not worked out. please help me. Thanks, Ramkrix |
|||
| Google The UNIX and Linux Forums |