apache 学习笔记

来源:互联网 发布:网络兼职赚钱是真的吗 编辑:程序博客网 时间:2024/06/10 07:13

使用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);

        }