home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / sci / math / symbolic / 2281 < prev    next >
Encoding:
Internet Message Format  |  1992-08-29  |  2.5 KB

  1. Path: sparky!uunet!dtix!darwin.sura.net!jvnc.net!yale.edu!ira.uka.de!chx400!bernina!neptune!monagan
  2. From: monagan@inf.ethz.ch (Michael)
  3. Newsgroups: sci.math.symbolic
  4. Subject: Re: Maple question
  5. Summary: Maple problem with C translation
  6. Keywords: output file, C.
  7. Message-ID: <1992Aug28.142042.19584@neptune.inf.ethz.ch>
  8. Date: 28 Aug 92 14:20:42 GMT
  9. References: <1992Aug27.160913.14137@athena.mit.edu>
  10. Sender: news@neptune.inf.ethz.ch (Mr News)
  11. Organization: Dept. Informatik, Swiss Federal Institute of Technology (ETH), Zurich, CH
  12. Lines: 41
  13. Nntp-Posting-Host: rutishauser-gw.inf.ethz.ch
  14.  
  15. In article <1992Aug27.160913.14137@athena.mit.edu>, bhattas@athena.mit.edu (Saurav D Bhatta) writes:
  16. > i am writing a procedure that generates symbolic expressions which i want to use
  17. > in a C program. i want to output the expressions to a file. so my question is
  18. > basically this: how would i output stuff to a file in a format readable by a C
  19. > program.
  20. > i tried the following methods:
  21. > 1) > C(expression,filename = `test.out`);
  22. > the problem with this was that every time i used this command, the file was
  23. > overwritten. since my procedure is going to generate a lot of different
  24. > expressions which i want to output to the file, i definitely do not want the file
  25. > to be overwirtten every time i write out a new expression (want an append mode);
  26.  
  27. Dear Saurav,
  28.  
  29. Yes, the C function and also the fortran function when given a filename for
  30. the output execute writeto(filename); which means the file gets overwritten.
  31. In the new versions, they execute appendto(filename); so the output
  32. is appended to the file.  This is what you want.  The new code is available
  33. in the Maple share library which you can get using anonymous ftp from
  34.  
  35.     Internet #    Internet address      Location   Directory
  36.     =================================================================
  37.     129.97.140.58   daisy.uwaterloo.ca    Waterloo   maple
  38.     129.132.101.33  neptune.inf.ethz.ch   Zurich     maple
  39.  
  40. Actually, a little Maple majic will also fix the problem.  Just subsitute
  41. the writeto call for appendto in the code by doing
  42.  
  43. C := subs(writeto=appendto,readlib(C));
  44.  
  45. However I recommend you try to get the new code as it contains a bug fix
  46. and will now breaks up large expressions which cause compilers to break.
  47. The reason why methods 2) and 3) that Saurav mentioned didn't work
  48. is because if one doesn't specify a filename, the old C and fortran codes
  49. explicitly write to the terminal, thus overriding the writeto(`test.out`);
  50. and open(`test.out`); statements Saurev used in methods 2) and 3).
  51.  
  52. Michael Monagan
  53.