Re: Write, Put,..

*To*: mathgroup at smc.vnet.net*Subject*: [mg62112] Re: Write, Put,..*From*: Uli <uli.wuerfel at fmf.uni-freiburg.de>*Date*: Sat, 12 Nov 2005 03:31:10 -0500 (EST)*References*: <dkuv5t$7jh$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

David Annetts schrieb: > Hi Uli, > > >>I used Export to get my data into a file. But now I would >>like to write text and arrays of numbers in a more direct way. >>My problem is that everytime I call e.g. PutAppend or >>WriteAppend Mathematica starts a new line. Is it not possible >>to control the output to a file in the same way like with >>outstream in C++?? >>I mean, e.g. to output an element of an array, and then a tab >>and then maybe a word,... > > > One way is to write your data to a string, then write the string to your > file. For example, > > Generate some data:- > > data = Random[] & /@ Range[25] > > Convert them to a string with special formatting:- > > str = StringJoin[ToString[FromCharacterCode[64 + #]], " = ", > ToString[data[[#]]], "\t"] & /@ Range[Length@data] > > And write them to a file:- > > outu = OpenWrite["temp.txt"]; > SetOptions[outu, PageWidth -> Infinity]; > ( > Write[outu, OutputForm[str]]; > ) & /@ Range[5] > Close[outu]; > > Regards, > > Dave. > Hi Kristjan, Dave and Albert, thanks a lot for your help. Greetings, Uli