Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

What happened with this file?

infile = "\\test data.txt";  

outstr = OpenWrite[infile];
instr = OpenRead[infile];
Read[instr, Record];

All content of "test data.txt" was lost.

share|improve this question
You should have used OpenAppend. – Mr.Wizard Mar 22 '13 at 16:52

1 Answer 1

From the help

OpenWrite["file"] open an output stream to a file, wiping out the previous contents of the file

... it's gone, you deleted it :

share|improve this answer
+1 for dry humor :^) – Mr.Wizard Mar 22 '13 at 16:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.