linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ruslan U. Zakirov" <cubic@wr.miee.ru>
To: linux-c-programming@vger.kernel.org
Subject: Can't understand how to get needed pointer.
Date: Thu, 24 Oct 2002 19:35:27 +0400	[thread overview]
Message-ID: <14296984741.20021024193527@wr.miee.ru> (raw)

Hello.
I've wrote function that convert in_str from charset to UTF-8.
It uses libiconv.
int convert_str(char *in_str,const char *charset,char *out_str)
{
        char *wrptr = (char *) out_str;
        char inbuf[MAX_SIZE];
        char *inptr = inbuf;
        size_t insize = strlen(in_str)+1;
        size_t avail = MAX_SIZE;
        size_t nconv;

        iconv_t cd;
        sprintf (inbuf,"%s",in_str);
        cd=iconv_open ("UTF-8",charset);
        nconv = iconv (cd, &inptr, &insize, &wrptr, &avail);
        iconv (cd, NULL, NULL, &wrptr, &avail);
        iconv_close(cd);
        return 0;
}
But I'v not understood how to get "const char* * inbuf" without
manipulations that I've done in code above. This code works fine, but
when I was compiling it gcc prints warning:
       gd_ft_test.c: In function `convert_str':
       gd_ft_test.c:83: warning: passing arg 2 of `iconv' from incompatible pointer type
I don't understand what I have to do with "char *in_str" to pass it to
iconv?
Here is declaration of function iconv:
size_t iconv (iconv_t cd,
                     const char* * inbuf, size_t * inbytesleft,
                     char* * outbuf, size_t * outbytesleft);

Thanks beforehead.
_________________________________________________________________________
Sorry for my English.


             reply	other threads:[~2002-10-24 15:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-24 15:35 Ruslan U. Zakirov [this message]
2002-10-24 16:32 ` Can't understand how to get needed pointer Tony Clarke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14296984741.20021024193527@wr.miee.ru \
    --to=cubic@wr.miee.ru \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).