Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Write ing strings without quotes and linefeeds

  • To: mathgroup at
  • Subject: [mg13336] Re: [mg13297] Write ing strings without quotes and linefeeds
  • From: David Withoff <withoff>
  • Date: Mon, 20 Jul 1998 02:49:56 -0400
  • Sender: owner-wri-mathgroup at

>     I am attempting to write a data file to disk using spaces as the
>     delimiters and linefeeds as record separators.  When I use Write, as in
>      Write[stream,"mystring \n","next line"]
>     what actually appears in the file is
>     "mystring \n""next line"
>     rather than:
>     mystring
>     next line
>     Does anyone know how to append line feeds onto strings and not put
>     quotes around strings?

Use OutputForm.  Apparently "stream" in this example was opened with
FormatType->InputForm, which is the default.

Two other issues that may be important here are that Write appends a
newline character to output automatically (use WriteString if you don't
want that), and concatenates the output when it is used with multiple

Here is one example of something that might be of interest:

In[4]:= WriteString["file", OutputForm["mystring \n"],
                                     OutputForm["next line"]]

In[5]:= !!file
next line

Or you could open the stream with FormatType -> OutputForm in the first
place, or you could change the input and take advantage of the newline
that is appended by Write, etc.

Dave Withoff
Wolfram Research

  • Prev by Date: terminology
  • Next by Date: Re: Re: Re: coordinate transformation
  • Previous by thread: Write ing strings without quotes and linefeeds
  • Next by thread: Re: Write ing strings without quotes and linefeeds