Ok... here's my problem:
I have 2 files File1 & File2 in the current dir.
My program is supposed to check if File2's content exists in File1 and delete it.
The way I'm approaching it is:
1) I check if File2's content exists in File1.
2) Then I create a tempFile and append to it everything in File1 but 40(which is File2's content).
3) Now I want to over-write File1's content with tempFile's content, but I'll end up with 20 30 40 again...
My question is, is it possible to completely delete File1's content so that I can easily just write tempFile's content into File1? If so, how? If not, what other option do I have?
Thanx in advance!
I have 2 files File1 & File2 in the current dir.
Code:
File1: File2: tempFile:
20 40 20
30 30
40
My program is supposed to check if File2's content exists in File1 and delete it.
The way I'm approaching it is:
1) I check if File2's content exists in File1.
2) Then I create a tempFile and append to it everything in File1 but 40(which is File2's content).
3) Now I want to over-write File1's content with tempFile's content, but I'll end up with 20 30 40 again...
My question is, is it possible to completely delete File1's content so that I can easily just write tempFile's content into File1? If so, how? If not, what other option do I have?
Thanx in advance!