{

      str_normalize_init();
    unsigned options = SNO_TO_LOWER | SNO_TO_HALF;
    if (argc > 1)
        options = atoi(argv[1]);

char *buffer = (char *)malloc(65536);
    memset(buffer, 0, 65536);

  //相当于std::cin
    while (fgets(buffer, 65536, stdin))
    {
        str_normalize_utf8(buffer, options);
        printf("%s", buffer);
    }
    free(buffer);

}

C/C++ fgets的更多相关文章

  1. php函数fgets读取文件

    如果一个文件比较大,可以考虑用fgets函数 下面是个例子: #文件作用:fgets读取文件 $start_time = microtime(true); $file_name = "a.t ...

  2. Linux C 字符串输入函数 gets()、fgets()、scanf() 详解

    一.gets() 函数详解 gets()函数用来从 标准输入设备(键盘)读取字符串直到 回车结束,但回车符('\n')不属于这个字符串. 调用格式为: gets(str); 其中str为字符串变量(字 ...

  3. c语言中gets ,getschar 和fgets 的用法及三者之间的差别,还有scanf

    ①gets [1]函数:gets(字符指针) [2]头文件:stdio.h(c中),c++不需包含此头文件 [3]原型:char*gets(char*buffer); [4]功能:从stdin流中读取 ...

  4. 函数fgets和fputs、fread和fwrite、fscanf和fprintf用法小结 (转)

    函数fgets和fputs.fread和fwrite.fscanf和fprintf用法小结 字符串读写函数fgets和fputs 一.读字符串函数fgets函数的功能是从指定的文件中读一个字符串到字符 ...

  5. 读取文件内容fopen,fgets,fclose

    <?php //首先采用“fopen”函数打开文件,得到返回值的就是资源类型.$file_handle = fopen("/data/webroot/resource/php/f.tx ...

  6. gets(),fgets()的作用机制探究

    gets(),fgets() scanf("%d",&a)若接受形如 2 这样的输入后,缓冲区内会留一个\n,此后若调用gets等函数时会读出这个换行出现错误,需注意 fg ...

  7. fgets函数

    打开文件 fopen("需要打开的路径") 然后使用fgets函数读取行 #include <stdio.h> #include <stdlib.h> #i ...

  8. hdu 1039 (string process, fgets, scanf, neat utilization of switch clause) 分类: hdoj 2015-06-16 22:15 38人阅读 评论(0) 收藏

    (string process, fgets, scanf, neat utilization of switch clause) simple problem, simple code. #incl ...

  9. hdu 1036 (I/O routines, fgets, sscanf, %02d, rounding, atoi, strtol) 分类: hdoj 2015-06-16 19:37 32人阅读 评论(0) 收藏

    thanks to http://stackoverflow.com/questions/2144459/using-scanf-to-accept-user-input and http://sta ...

  10. fgets读取文件时的注意事项

    1 文本文件 a.txt 内容如下 2 c代码 FILE *fil; if (!(fil = fopen("/home/rudy/projects/paser/a.txt", &q ...

随机推荐

  1. Anaconda基本命令

    创建环境 conda create --name bunnies python=3 astroid babel 列出所有环境 conda info --envs 或 conda env list 克隆 ...

  2. MySQL数据库基本操作以及SQL语句

    连接mysql的语法 mysql -u用户名 -p密码 [-h主机名] [-P端口号] 在一个mysql服务器中, 可以有多个mysql数据库(本质是一个文件夹) 在一个mysql数据库中, 可以有多 ...

  3. hdu 6134 Battlestation Operational (莫比乌斯反演+埃式筛)

    Problem Description   > The Death Star, known officially as the DS-1 Orbital Battle Station, also ...

  4. paper 141:some paper with ComputerCV、MachineLearning[转]

    copy from:http://blog.csdn.net/zouxy09/article/details/8550952 一.特征提取Feature Extraction: ·         S ...

  5. 前端每日实战:57# 视频演示如何用纯 CSS 创作一双黑暗中的眼睛

    效果预览 按下右侧的"点击预览"按钮可以在当前页面预览,点击链接可以全屏预览. https://codepen.io/comehope/pen/xzYVzO 可交互视频 此视频是可 ...

  6. Python3中 if __name__=='__main__'是个什么意思

    在python前期学习中或者在学flask中,if_name_ = ="_main_"经常出现在我们的眼帘中,我们经常会问,这个是个什么玩意儿,它是干什么的? 我们知道,if 语句 ...

  7. CentOS 7 & php7.2安装 php-redis 扩展

    CentOS 7 & php7.2安装 php-redis 扩展 1.下载phpredis-developcd /tmpwget https://codeload.github.com/php ...

  8. MySQL-8.0填坑

    Client does not support authentication protocol 或 Authentication plugin 'caching_sha2_password' cann ...

  9. JS制作二级联动

    JS制作二级联动 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ww ...

  10. Mac-VScode

    1) 安装 xcode. 打开App Store,搜索xcode,进行下载安装. 2)执行命令: xcode-select --install 3)安装VS Code https://code.vis ...