How does one write a single " to a text file in Fricas?
I need to write a string to a text file, but also keep the " " around the
string and
not have those removed when the string is written. This is because later
when
I read the file using another program, I need to have those "" there so I
can
read it as string.
Here is an example
-------------------------
f2: TextFile := open("/tmp/foo.txt", "output")
ii:=integrate(1/(a^2+b^2*x^2), x)
-------------------------
Now I want to write variable ii to the file as string. We see it is string
when
doing this
unparse(ii::InputForm)
(45) "atan((b*x)/a)/(a*b)"
Type:
String
So I did this
----------------------
(46) -> writeLine!(f2, unparse(ii::InputForm) )
close!(f2)
----------------------
But when I look at the file, the string quotes that show up on the screen
" "
are missing at the start and at the end in the file
atan((b*x)/a)/(a*b)
So the way I do this in Maple for example, is to add explicit " at end and
at start. But I do not know how to tell fricas to write a single ". I do
not
know how to escape the "
I tried
writeLine!(f2, concat("\"", unparse(ii::InputForm), "\"") )
And tried
write!(f2, "\"")
write!(f2, unparse(ii::InputForm))
write!(f2, "\"")
writeLine!(f2)
But the problem is, I do not know how to write a single " to the file.
Thanks
--Nasser
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.