Re: Input, output troubles me ...
- To: mathgroup at smc.vnet.net
- Subject: [mg70094] Re: Input, output troubles me ...
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Tue, 3 Oct 2006 06:16:41 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <firstname.lastname@example.org> <email@example.com>
luigirmailbox-mathematica at yahoo.it wrote: > Thanks for your quick and useful replies! > > Now it works fine but still a point rimanes to be fixed up. > As far as I see, Write has no options, so how can I prevent > Mathematica from enclosing each row of the output file between > quotes ? > > Best regards. > You can change the format of the expressions either for the whole file (see example below) or on an expression basis by enclosing the expression with a wrapper function such as, say, TexForm, etc. Section 2.12.3, "Advanced Topic: Streams and Lowâ??Level Input and Output," of /The Mathematica Book/ explains all of these points in details . stream1 = OpenRead["c:\\temp\\inputFile.txt"]; stream2 = OpenWrite["c:\\temp\\outputFile.txt", FormatType -> OutputForm]; dummy = Read[stream1, "String"]; While[dummy =!= EndOfFile, If[dummy != "a", Write[stream2, dummy]]; dummy = Read[stream1, "String"]; ] Close[stream1]; Close[stream2]; Regards, Jean-Marc  http://documents.wolfram.com/mathematica/book/section-2.12.3