apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Marantz <jmara...@google.com>
Subject Re: How to convert char[] to char*?
Date Tue, 28 May 2013 13:51:58 GMT
Two questions:

1. Can you paste the code where you call apr_socket_recv including
(especially) the declaration of buf?  How big is the array at its
allocation point?
2. How are you transmitting the length of the string from apr_socket_recv
to ap_rputs?
3. What is the exact nature of the failure you saw?

Make that three questions!


On Mon, May 27, 2013 at 5:25 PM, Ben Reser <ben@reser.org> wrote:

> On Mon, May 27, 2013 at 1:21 PM, Graf László <grafl@datatrans.hu> wrote:
> > I have a handler module which reads the HTTP response from a remote web
> > server.
> > In this module I have a
> >
> > char[] buf
> >
> > and it contains the bytes red using apr_socket_recv. With
> >
> > ap_log_perror(APLOG_MARK, APLOG_NOTICE, 0, r->pool, apr_psprintf(r->pool,
> > "<%s>", buf));
> >
> > I can see the buf's content in the error_log but the
> >
> > ap_rputs(apr_psprintf(r->pool, "%s", (char *)buf), r);
> >
> > fails. How can I convert this array to a char* to be able to put the HTTP
> > response in the handler's request using ap_rputs?
>
> You haven't given enough info to answer your question.  However, this
> is really a question of how to write C so I'd point you to references
> on C.
>
> See this question on Stack Overflow:
>
> http://stackoverflow.com/questions/1790704/difference-between-square-brackets-and-asterisk
>
> (that question is about C++ but as far as I know there's no difference
> between the two in this case)
>

Mime
View raw message