Re: file question
- To: mathgroup at smc.vnet.net
- Subject: [mg70651] Re: file question
- From: Bill Rowe <readnewsciv at sbcglobal.net>
- Date: Sun, 22 Oct 2006 01:19:44 -0400 (EDT)
On 10/21/06 at 5:14 AM, dimmechan at yahoo.com (dimitris) wrote:
>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"
Either set the working directory to $BaseDirectory by doing
SetDirectory@$BaseDirectory
or include $BaseDirectory in the file name using ToFileName, i.e.,
filename = ToFileName[$BaseDirectory, "file.dat"]
and replace "file.dat" everywhere in your example code with
filename defined as above
--
To reply via email subtract one hundred and four