May 18, 2005 #1 S smith_kang Member level 5 Joined Jan 22, 2005 Messages 89 Helped 4 Reputation 8 Reaction score 3 Trophy points 1,288 Activity points 861 hi all I want to write a code in C such that it will erase the content of a file modified 24 hr before. lets say i wrote file yesterday and if today i open this file it should be blank.file should be there contents should erase. thanks in advance
hi all I want to write a code in C such that it will erase the content of a file modified 24 hr before. lets say i wrote file yesterday and if today i open this file it should be blank.file should be there contents should erase. thanks in advance
May 19, 2005 #2 R raj_rohit10 Advanced Member level 4 Joined Jul 14, 2004 Messages 100 Helped 2 Reputation 4 Reaction score 1 Trophy points 1,298 Activity points 891 hi, can u clarify the exact OS on which u want this code ??
May 21, 2005 #3 C Cortex Full Member level 3 Joined Mar 26, 2005 Messages 182 Helped 12 Reputation 24 Reaction score 4 Trophy points 1,298 Location Morocco Activity points 2,733 erase the whole file and create it again
May 25, 2005 #4 A alvarorahul Advanced Member level 4 Joined Apr 13, 2005 Messages 110 Helped 6 Reputation 12 Reaction score 1 Trophy points 1,298 Activity points 2,062 you could open the file in write only mode i.e. "w" mode for example void main() { FILE *fp; fp=fopen("c:\\mysoftwr\\trial.txt","w"); } Added after 2 minutes: pls note that while writing the filename the double back-slash is necessary
you could open the file in write only mode i.e. "w" mode for example void main() { FILE *fp; fp=fopen("c:\\mysoftwr\\trial.txt","w"); } Added after 2 minutes: pls note that while writing the filename the double back-slash is necessary
Jun 7, 2005 #5 S sathishkrishna Newbie level 6 Joined Sep 10, 2004 Messages 12 Helped 2 Reputation 4 Reaction score 0 Trophy points 1,281 Activity points 339 U can acess the file flags such as the date and time and attributes(hidden/readonly/system) from the C functions itself, I think ur purpose is solved
U can acess the file flags such as the date and time and attributes(hidden/readonly/system) from the C functions itself, I think ur purpose is solved