× 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.



Thank everyone for their help.

Is the iconv_t cd object reusable? When I repeatedly call 

int rc = iconv(cd, &pRecord,&inBytesLeft,&pAsciiBuffer,&outBytesLeft); 

I get a message to the effect that the descriptor is bad. Does one have
to create a new iconv_t object for each call to iconv()?

On Fri, 2006-04-07 at 12:20 -0500, Scott Klement wrote:
> > which is the text associated with errno. This is V5R2. I am trying to do 
> > ebcdic to ascii translation. I would much appreciate any ideas anyone 
> > might have.
> 
> I prefer to use QtqIconvOpen(), I find that it's a little nicer than 
> iconv_open().  Here's a sample of translating EBCDIC -> ASCII using that 
> technique:
> 
> #include <qtqiconv.h>
> #include <iconv.h>
> #include <string.h>
> #include <errno.h>
> #include <stdio.h>
> #include <stdlib.h>
> 
> #define OUTBUFSIZE 32768
> 
> int main(int argc, char **argv) {
> 
>      QtqCode_T from, to;
>      iconv_t ic;
>      size_t insize, outleft;
>      char outbuf[OUTBUFSIZE];
>      char *inptr, *outptr;
> 
>      memset(&from, 0, sizeof(from));
>      memset(&to, 0, sizeof(to));
> 
>      from.CCSID = 0;     // current job's EBCDIC
>      to.CCSID   = 819;   // ISO 8859-1 ASCII
> 
>      ic = QtqIconvOpen(&to, &from);
>      if (ic.return_value == -1) {
>         fprintf(stderr, "QtqIconvOpen(): %s\n", strerror(errno));
>         exit(1);
>      }
> 
>      insize = strlen(argv[1]);
>      inptr = argv[1];
> 
>      outleft = OUTBUFSIZE;
>      outptr  = &outbuf[0];
> 
>      iconv(ic, &inptr, &insize, &outptr, &outleft);
>      iconv_close(ic);
> 
>      printf("ASCII string = %s\n", outbuf);
>      return 0;
> }
> 

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.