× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



List,

 

I have a problem: I want to create a stream file with data in UTF-8 format.
Thanks to Scott Klement, I've sorted out my open() O_CCSID vs O_CODEPAGE
dilemma, but I need to convert my data before I write it to the file.

Sounds simple? It should be. The problem is that I know I can use the
iconv_open(), iconv() and iconv_close() triplets to do the CCSID conversion
of the data I have sitting on my pointers, but I can't seem to get it
working. I can perform the open ok (return value of 0). It's calling iconv()
that is causing me grief.

When I look through the API information provided by IBM it seems pretty
straightforward, but all examples I have seen on this and other lists seem
to contradict the information I have from IBM. As an example, the return
value of iconv() should be of datatype size_t, which is defined in the
stddef.h file as an unsigned integer. Having said this, I've seen several
examples of code calling iconv() to return an int. Not the biggest crime I
know, but I've seen examples of calls to iconv() passing pointers addressing
int variables where size_t (unsigned int) variables should be used. When I
tried passing pointers to ints the call to iconv() fell over with a
"receiver too small." error. This only stopped when I redefined my variables
to be unsigned ints. This has got me stumped. Can anyone provide a
definitive prototype for the calls to these APIs? A full example would be
lovely, all examples I've found so far omit key field definitions. (You know
the type, an eval of the pointer inbuf = %addr of variableA, but no
definition of variableA anywhere, so what exactly are we pointing to? A
string? The address of another pointer? You get the idea).

 

Any help, even an explanation of exactly what I'm supposed to be passing so
I can work it out myself, would be appreciated.

 

Cheers

Larry 

 


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.