Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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.