[julia-users] ccall using streams and printing to STDOUT, string

2016-03-09 Thread Jeffrey Sarnoff
I am trying to wrap this so it will (a) print to STDOUT (b) (if possible) print to a string: void arf_fprint(FILE ** file*, const arf_t * x*)¶ Prints *x* as an integer mantissa and exponent to the stream *

Re: [julia-users] ccall using streams and printing to STDOUT, string

2016-03-09 Thread Milan Bouchet-Valat
Le mercredi 09 mars 2016 à 09:38 -0800, Jeffrey Sarnoff a écrit : > I am trying to wrap this so it will (a) print to STDOUT (b) (if > possible) print to a string: > void arf_fprint(FILE * file, const arf_t x)¶ > Prints x as an integer mantissa and exponent to the stream file. > > arf_t is made wit

Re: [julia-users] ccall using streams and printing to STDOUT, string

2016-03-09 Thread Yichao Yu
On Mar 9, 2016 12:38 PM, "Jeffrey Sarnoff" wrote: > > I am trying to wrap this so it will (a) print to STDOUT (b) (if possible) print to a string: > void arf_fprint(FILE * file, const arf_t x)¶ > > Prints x as an integer mantissa and exponent to the stream file. > > > arf_t is made with arf(x), t

Re: [julia-users] ccall using streams and printing to STDOUT, string

2016-03-09 Thread Jeffrey Sarnoff
I am bound to the api, at least for calling into the application. I don't know how to do either of the things you recommend. Could you point me to an example? On Wednesday, March 9, 2016 at 12:58:20 PM UTC-5, Yichao Yu wrote: > > > On Mar 9, 2016 12:38 PM, "Jeffrey Sarnoff" > wrote: > > > > I

Re: [julia-users] ccall using streams and printing to STDOUT, string

2016-03-09 Thread Yichao Yu
On Wed, Mar 9, 2016 at 1:05 PM, Jeffrey Sarnoff wrote: > I am bound to the api, at least for calling into the application. I don't > know how to do either of the things you recommend. Could you point me to an > example? See below. Note that the `open_memstream` API may not be widely available o

Re: [julia-users] ccall using streams and printing to STDOUT, string

2016-03-09 Thread Jeffrey Sarnoff
Thank you, much appreciated. On Wednesday, March 9, 2016 at 2:52:01 PM UTC-5, Yichao Yu wrote: > > On Wed, Mar 9, 2016 at 1:05 PM, Jeffrey Sarnoff > > wrote: > > I am bound to the api, at least for calling into the application. I > don't > > know how to do either of the things you recommend.

Re: [julia-users] ccall using streams and printing to STDOUT, string

2016-03-09 Thread Jeffrey Sarnoff
In both version 0.4 and 0.5-dev everything is as you show until: pointer_to_array(Ptr{UInt8}(ptr[]), sz[], true) then julia> pointer_to_array(Ptr{UInt8}(ptr[]), sz[], true) 140685948747867-element Array{UInt8,1}: signal (11): Segmentation fault while loading no file, in expression starting on li

Re: [julia-users] ccall using streams and printing to STDOUT, string

2016-03-09 Thread Yichao Yu
On Wed, Mar 9, 2016 at 5:21 PM, Jeffrey Sarnoff wrote: > In both version 0.4 and 0.5-dev everything is as you show until: > pointer_to_array(Ptr{UInt8}(ptr[]), sz[], true) > then > julia> pointer_to_array(Ptr{UInt8}(ptr[]), sz[], true) > 140685948747867-element Array{UInt8,1}: What I see is that

Re: [julia-users] ccall using streams and printing to STDOUT, string

2016-03-09 Thread Yichao Yu
On Wed, Mar 9, 2016 at 5:36 PM, Yichao Yu wrote: > On Wed, Mar 9, 2016 at 5:21 PM, Jeffrey Sarnoff > wrote: >> In both version 0.4 and 0.5-dev everything is as you show until: >> pointer_to_array(Ptr{UInt8}(ptr[]), sz[], true) >> then >> julia> pointer_to_array(Ptr{UInt8}(ptr[]), sz[], true) >> 1

Re: [julia-users] ccall using streams and printing to STDOUT, string

2016-03-09 Thread Jeffrey Sarnoff
can it be used to convert a c FILE (STDOUT) to a specific julia IO object? On Wed, Mar 9, 2016 at 6:43 PM, Yichao Yu wrote: > On Wed, Mar 9, 2016 at 5:36 PM, Yichao Yu wrote: > > On Wed, Mar 9, 2016 at 5:21 PM, Jeffrey Sarnoff > > wrote: > >> In both version 0.4 and 0.5-dev everything is as yo

Re: [julia-users] ccall using streams and printing to STDOUT, string

2016-03-09 Thread Jeffrey Sarnoff
Thanks again. I found a way through the apps' internal get_string. On Wednesday, March 9, 2016 at 7:41:32 PM UTC-5, Jeffrey Sarnoff wrote: > > can it be used to convert a c FILE (STDOUT) to a specific julia IO object? > > On Wed, Mar 9, 2016 at 6:43 PM, Yichao Yu wrote: > >> On Wed, Mar 9, 2016