Re: file question
- To: mathgroup at smc.vnet.net
- Subject: [mg70656] Re: file question
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Sun, 22 Oct 2006 01:20:00 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <ehcq32$t8o$1@smc.vnet.net>
dimitris wrote: > Hello. > > I have a simple question > > Suppose the following > > OpenWrite["file1.dat"] > OutputStream["file1.dat", 6] > > Do[WriteString["file1.dat", i, " ", i^3, "\n"], {i, 1, 8}]; > Close["file1.dat"] > "file1.dat" > > The created file is saved in the following directory > > Directory[] > "C:\\Program Files\\Wolfram Research\\Mathematica\\5.2" > > How can I save a file created in this way in another directory > e.g. in > > $BaseDirectory > "C:\\Documents and Settings\\All Users\\Application Data\\Mathematica" > > Thanks. > Hi Dimitris, Among few other things, you can write the path where the file should be located within the file name. For instance, fileName = "C:\\Temp\\file1.dat"; channel = OpenWrite[fileName]; WriteString[channel, "expr1", "expr2"]; Close[channel]; Regards, Jean-Marc