zoukankan      html  css  js  c++  java
  • std io的一个笔记

    之前一直用fread和fwrite,但是一直没有认真看过manual page。这次看apue才发现,自己之前有个误解。

    std io 操作

    size_t fwrite(const void *BUF, size_t SIZE,
    size_t COUNT, FILE *FP);

    If `fwrite' succeeds in writing all the elements you specify, the
    result is the same as the argument COUNT. In any event, the
    result is the number of complete elements that `fwrite' copied to
    the file.

    从manual page可以看出,fwrite返回的是写入的个数COUNT,而不是SIZE*COUNT。之前一直误会了fwrite。
    现在记下来以免再犯。

    size_t fread(void *BUF, size_t SIZE, size_t COUNT,
    FILE *FP);
    fread返回值与fwrite同理。
    The result of `fread' is the number of elements it succeeded in
    reading.

  • 相关阅读:
    组件映射
    联合主键关联
    一对一单向双向主键关联
    7函数
    forEach与map
    3运算符与表达式
    作用域声明提升
    php程序设计 1,2章节
    angularJs(3)过滤器
    angularJs(1)指令篇
  • 原文地址:https://www.cnblogs.com/jojodru/p/2715015.html
Copyright © 2011-2022 走看看