|
michael@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx wrote: > > I iconv the data on the pointer for the length of the data on the pointer > back onto itself. Again this does not return an error, but the pointer is > cleared and the length is set to zero. What am I doing wrong? > I could use QDCXLATE but that would be admitting defeat. Michael, if iconv converts 10 bytes, it moves both the pointer parameters ahead 10 bytes and subtracts 10 from the input and output length parameters. (Assuming the output length is also 10.) You need extra pointer variables and length variables to pass to iconv. tempInput = inputDataPtr; tempOutput = outputDataPtr; tempInputLen = lengthOfInput; tempOutputLen = lengthOfOutput; iconv (conv : tempInput : tempInputLen : tempOutput : tempOutputLen); Now if everything went well, tempInputLen is zero, meaning it converted the entire input. The actual length of the output is (lengthOfOutput - tempOutputLen); tempOutputLen has the remainder of the output that it didn't need. But I don't know if iconv supports having the output be the same actual storage as the input. You might need to use a separate output buffer. It might work ok if the conversion is byte for byte, but if the output value was longer, say from EBCDIC to unicode, or ASCII with DBCS to EBCDIC with DBCS, then I would think it would overwrite the data that it hadn't converted yet.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.