Results 1 to 4 of 4
hey
im programming in c , and i want to open a new EMPTY file , im using the
"open" system call . this is my code:
Code:
fd=open(filename, O_WRONLY ...
- 11-16-2007 #1Just Joined!
- Join Date
- Nov 2006
- Posts
- 33
open empty file
hey
im programming in c , and i want to open a new EMPTY file , im using the
"open" system call . this is my code:
but this open me the old file (if there is such one) ... and i want to open a new empty one..Code:fd=open(filename, O_WRONLY | O_CREAT);
how can i do this ?
thanks !
- 11-16-2007 #2
Do this at the command line:
and all will be revealed.Code:man truncate man ftruncate
--
Bill
Old age and treachery will overcome youth and skill.
- 11-24-2007 #3Linux Engineer
- Join Date
- Feb 2005
- Posts
- 1,044
Better to "man 2 open" and learn about O_TRUNC.
- 11-24-2007 #4Correct. I don't know what I was thinking. Furrfu.Better to "man 2 open" and learn about O_TRUNC.--
Bill
Old age and treachery will overcome youth and skill.


Reply With Quote