MathGroup Archive 2004

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

Search the Archive

Re: Writing strings

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49239] Re: Writing strings
  • From: "Hans Michel" <hansjm at bellsouth.net>
  • Date: Fri, 9 Jul 2004 02:26:09 -0400 (EDT)
  • References: <ccisfl$4ek$1@smc.vnet.net>
  • Reply-to: "Hans Michel" <hansjm at bellsouth.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Try
tat=OpenRead["c:\\file"];
ys=Flatten[ReadList[tat, Expression, RecordLists -> False]]

ys[[2]]

another sttring

Hans

<camartin at snet.net> wrote in message news:ccisfl$4ek$1 at smc.vnet.net...
> Group,
>
> Why is it when I write a list of strings to a file, then try to read it
> back later, the list has only one element per line?
>
> For example
>
> g= {"some string", "another sttring"}
> rat=OpenAppend["c:\file"]
> Write[rat, g]
> Close[rat]
>
> This writes to a file
>
> {"some string", "another sttring"}
>
>
> When I read it back in using
>
> tat=OpenRead["c:\\file"]
> ys=ReadList[tat, String]
>
> It reads the file in but there is only one element in the list i.e.
>
> p=ys[[1]] = {"some string", "another sttring"}
> p[[1]]
> doesn't exist.  That means I can't recover the different strings.  Could
> someone explain this and how I can get a list of strings I can use or
> partition?
>
> Thanks in advance.
>
> Cliff
>


  • Prev by Date: Re: Writing strings
  • Next by Date: Re: DOES MATHEMATICA CHANGE THE SYNTAX EACH NEW RELEASE?
  • Previous by thread: Re: Writing strings
  • Next by thread: Getting rid of ProductLog