Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

file modification code

Status
Not open for further replies.

smith_kang

Member level 5
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,
can u clarify the exact OS on which u want this code ??
 

erase the whole file and create it again
 

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
 

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
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top