The biggest gamble will be to ask a question whose answer you know in that it will challenge your theory | www.TechAspire.blogspot.in
Rajdeep Biswas wrote:Hello,
I have:
String path = "c:\\myfolder\\sampleFile.txt"; //This is mandatory, the complete path to file comes from elsewhere in the program
I want to delete this file after modifying its contents (storing the modified contents to a different file at same location: c:\\myfolder\\sampleFile.txt.tmp).
I want to delete the original sampleFile.txt file, and then rename the temp sampleFile.txt.tmp file to sampleFile.txt.
I am doing something like:
Its not working!!!
How do I do this?
Thank you
Programming is about thinking, NOT coding
Don't you think you appended a .tmp to the path name (so that c:\\myfolder\\sampleFile.txt becomes c:\\myfolder\\sampleFile.txt.tmp ) which does not exists. Thus , trying to open this file should result in an error
The biggest gamble will be to ask a question whose answer you know in that it will challenge your theory | www.TechAspire.blogspot.in
The biggest gamble will be to ask a question whose answer you know in that it will challenge your theory | www.TechAspire.blogspot.in
The biggest gamble will be to ask a question whose answer you know in that it will challenge your theory | www.TechAspire.blogspot.in
The biggest gamble will be to ask a question whose answer you know in that it will challenge your theory | www.TechAspire.blogspot.in
The biggest gamble will be to ask a question whose answer you know in that it will challenge your theory | www.TechAspire.blogspot.in
Tony Docherty wrote:What actually creates this file in the first place?
The biggest gamble will be to ask a question whose answer you know in that it will challenge your theory | www.TechAspire.blogspot.in
Rajdeep wrote: Okay, the lines written were not faltering. Either JVM or/and OS or/and other no-under-my-control-considering-coding conditions are responsible for non-deletion.....
The biggest gamble will be to ask a question whose answer you know in that it will challenge your theory | www.TechAspire.blogspot.in
It sure was nice of your sister to lend us her car. Let's show our appreciation by sharing this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|