5
$\begingroup$

What happened with this file?

infile = "\\test data.txt";  

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

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

$\endgroup$
1
  • 1
    $\begingroup$ You should have used OpenAppend. $\endgroup$ – Mr.Wizard Mar 22 '13 at 16:52
12
$\begingroup$

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 :

$\endgroup$
0

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