octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "save" to and "load" from file descriptor


From: Thomas Geiger
Subject: Re: "save" to and "load" from file descriptor
Date: Tue, 12 Jun 2007 10:33:27 +0200

Hi,


I had a similar problem when building the grid toolbox. The
grid-enabled load/save methods wrap the octave load_data/save_data
methods and extend it also with the xml format (from the xml-toolbox).


On 12/06/07, David Bateman <address@hidden> wrote:
John W. Eaton wrote:
> On 11-Jun-2007, Olaf Till wrote:
>
> | So this probably will solve the problem. Still IMHO it is worth
> | considering to make octaves "save" and "load" code work on strings
> | (like octave-xmltools) or, better, on file descriptors (or
> | sockets). It would be more straightforward than producing XML strings
> | with an external tool and feeding them through the pipe by hand.
>
> If you want to discuss a change like this, then please open a thread
> on the maintainers list.  A proposed patch would also help...
>
> jwe
>
In fact a change like that wouldn't be too difficult as the prototypes
for octave's binary format

extern bool
save_binary_data (std::ostream& os, const octave_value& tc,
                  const std::string& name, const std::string& doc,
                  bool mark_as_global, bool save_as_floats);

extern std::string
read_binary_data (std::istream& is, bool swap,
                  oct_mach_info::float_format fmt,
                  const std::string& filename, bool& global,
                  octave_value& tc, std::string& doc);

would tell you. You just need a wrapper to setup the iostreams on both
sides and then install the variables into memory on the reader's side...
Should be relatively easy..


This hack allowed me to access _all_ file formats supported by octave
(http://octave-gridtoolbox.googlecode.com/svn/trunk/octave_grid_toolbox/gt-ls.cc).
It's not nice  but well...


kind regards,
tom


reply via email to

[Prev in Thread] Current Thread [Next in Thread]