Bjorn Helgason wrote:
>   (q,LF) 1!:2  <'c:\q1.txt' 

and Ric Sherlock wrote:
> The verb fwrites (write a file as a string) takes the left argument
> and does a toHOST on it (undoing your toJ) before writing to file.
> If you want to write the actual content of the left argument without
> it being changed you should use the fwrite verb instead. 
> (toJ,q) fwrite...


Thanks, Bjorn and Ric, but...  for whatever reason, using "fwrite" 
doesn't seem to work, always giving errors--that's why I didn't include 
it in my original examples.  (I actually had tried all of these 
"fwrite" variations before writing my original message, but because 
none of them worked, I limited myself in that info request to those 
forms that *did* work.)  Here are results from your suggestions:

Bjorn:

   (q,LF) 1!:2 <'c:\q1.txt'  NB. your original suggestion
|domain error
|   (q    ,LF)1!:2<'c:\q1.txt'

   (LF,q) 1!:2 <'c:\q1.txt'  NB. xchg x args
|domain error
|   (LF    ,q)1!:2<'c:\q1.txt'

   (q,LF) 1!:2 jpath ('~user\data\q1.txt')  NB. variant file spec
|domain error
|   (q    ,LF)1!:2 jpath('~user\data\q1.txt')

   (q,LF) fwrite <'c:\q1.txt'  NB. variant verb form
|domain error
|   (q    ,LF)fwrite<'c:\q1.txt'
   
   (LF,q) fwrite <'c:\q1.txt'  NB. xchg x args
|domain error
|   (LF    ,q)fwrite<'c:\q1.txt'

   (q,LF) fwrite jpath ('~user\data\q1.txt')  NB. variant verb form
|domain error
|   (q    ,LF)fwrite jpath('~user\data\q1.txt')

   (LF,q) fwrite jpath ('~user\data\q1.txt')  NB. xchg x args
|domain error
|   (LF    ,q)fwrite jpath('~user\data\q1.txt')

Ric:

   (toJ,q) fwrite <'c:\q1.txt'  NB. your original suggestion
|domain error: toJ
|   (    toJ,q)fwrite<'c:\q1.txt'

   (q,toJ) fwrite <'c:\q1.txt'  NB. xchg x args
|value error: fwrite
|   (q,toJ)    fwrite<'c:\q1.txt'

   (toJ,q) fwrite jpath ('~user\data\q1.txt')  NB. variant file spec
|domain error: toJ
|   (    toJ,q)fwrite jpath('~user\data\q1.txt')

   (q,toJ) fwrite jpath ('~user\data\q1.txt')  NB. xchg x args
|value error: fwrite
|   (q,toJ)    fwrite jpath('~user\data\q1.txt')

   (toJ,q) 1!:2 <'c:\q1.txt'  NB. variant verb form
|domain error: toJ
|   (    toJ,q)1!:2<'c:\q1.txt'

   (toJ,q) 1!:2 jpath ('~user\data\q1.txt')  NB. variant verb form
|domain error: toJ
|   (    toJ,q)1!:2 jpath('~user\data\q1.txt')

As you can see, I tried exchanging the "x" arguments, exchanging the 
verb form between "fwrite" and "1!:2", and exchanging the "jpath" 
syntax and regular syntax for the "y" arguments--but all to no avail.   
I just could not get "fwrite" to work correctly.  Any other 
suggestions?  Thanks!

Harvey

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to