现在的位置: 首页 > 综合 > 正文

apache 学习笔记

2013年10月15日 ⁄ 综合 ⁄ 共 278字 ⁄ 字号 评论关闭

使用apache 源码中的apr_file_gets() 可以从文件中读取指定长度的数据到字符串

函数原型:

apr_file_gets(char *str, int len,  apr_file_t *thefile);

str 要写入的字符串

len 读取长度

thefile 文件

我们可以通过这个函数读取整个文件内容:

如下:

  while ((rv = apr_file_gets(str, 256,fp)) == APR_SUCCESS) {

                            printf("str=%s",str);

        }

抱歉!评论已关闭.