|
Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006
C : the language of judgment! ! !
#include<unistd.h>
Int main ()
{
CONFIG= "/tmp/tx"
If [-f] $CONFIG
Then
Echo "$CONFIG"
Else
Echo "who your file name"
}
Above it is a fake. .
Now how in the C language to judge the existence of a document. . Will show different information! ! !
For instance : the existence of judgment /tmp/tx
Then showed its contents
Else shows who your file name
Brother wing who! ! ! ! ! ! ! ! |
Stat
Fstat |
Access fstat stat |
Give me an example! ! ! ! ! |
Too many. . . . |
[code]struct Stat buf;
If (stat ( "/tmp/tx" &buf) ====== 0)
{
There 4003rd
.....
}
Else (
4003rd does not exist
....
}[/code] |
Generally, stat.
Solaris can be tried if the guideline document for the return NULL, it can be established that do not exist, but in fact you did not have authority may read this document. |
Let me try ~! 3Q |
-->
This seems to be under your shell language test |
Try it out themselves |
To the more |
-->
------------------------
I tried this seems not ah? ! |
| |