我的结构如下
typedef struct
{
char *ptr;
size_t used;
size_t size;
} buffer;
typedef struct
{
buffer *request;
buffer *uri;
buffer *orig_uri;
http_method_t http_method;
http_version_t http_version;
buffer *request_line;
/* strings to the header */
buffer *http_host; /* not alloced */
const char *http_range;
const char *http_content_type;
const char *http_if_modified_since;
const char *http_if_none_match;
array *headers;
/* CONTENT */
size_t content_length; /* returned by strtoul() */
/* internal representation */
int accept_encoding;
/* internal */
buffer *pathinfo;
} request;
现在,如果我想写入(在文本文件中)属于结构“请求”的成员“http_host”的值。成员“http_host”其实是一个“buffer”类型,应该怎么写呢?请用语法解释。