how to clear a file's content?
is there any api to use?
Regards. |
I'm not quite sure what you have in mind, but one way to empty a file is:
Code:
$ /bin/echo "" > filename |
Or if you want to jumble it up and make the contents unretreivable:
Code:
cat /dev/urandom > filename |
thanks, both.
BTW, is there any c API? |
Just open the file in write only mode and it will be truncated to a length of 0.
#man fopen will give you the full details |
Quote:
Code:
fopen ("path_to_file", "w"); |
You got it.
|
echo -n > file
|
All times are GMT -5. The time now is 09:24 PM. |