Re: Read error in Mathematica Win 2.0
- To: mathgroup at yoda.physics.unc.edu
- Subject: Re: Read error in Mathematica Win 2.0
- From: John Fultz <jfultz>
- Date: Tue, 12 Apr 1994 04:00:17 -0500 (CDT)
>
> Here is a question of one of our Mathematica users on Win 2.0:
>
> I tried to read in a data file which contained 2 real numbers on each line
> in Mathematica for win 2.0. Below is my syntax:
>
> ReadList["c:\file.m", {Real, Real}];
>
> However, Mathematica always complains on syntax error reading in real
> number. Also the system crash frequently after evaluating the above
> expressio. The message is :
>
> General Application Error
> KRNL386.EXE at 0001:1BB0
> (simplifed)
>
> More seriously the system hang and warm is not functioning.
>
> Can anyone solve the above problems for me?
>
> Thanks a lot.
>
>
> -----------------------------------------------------------------------------
> Augustine Y. Lo | Internet: augustine-lo at cuhk.hk
> Computer Services Centre | Bitnet : a138700 at cucsc.bitnet
> The Chinese University of Hong kong | Phone : (852) 609-8837
> Shatin, HONG KONG | Fax : (852) 603-5001
> -----------------------------------------------------------------------------
You should always use double backslashes when specifying a filename,
as the backslash is normally an escape character inside a string (see
page 370 for more details). In this case, "c:\file.m" picks out the
\f and turns it into an ASCII 12, which is bad for filenames. The
solution is to use ReadList["c:\\file.m", {Real, Real}] instead
(note the doubled backslashes...this means use a literal backslash
instead of using the backslash as an escape sequence). Also, you
should make sure that your numbers are only separated by space, tabs
or carriage returns; you cannot use commas or other delimiters without
changing your input command.
-John
--------------------------------------------------------------------------------
John Fultz "I am not a mouthpiece for Wolfram Research."
jfultz at wri.com "Goldfish schoals, nibblin' at my toes, Fun, fun, fun..."
--------------------------------------------------------------------------------