c - 找出读取/写入读取的字符数

标签 c io

我是 c 的新手,所以请多多包涵。

  1. 如何找出读取/写入读取的字符数?

  2. 我可以更具体地指定参数中读取/写入的字符数吗?如果是,怎么办?

最佳答案

来自 man(2) 阅读:

If successful, the number of bytes actually read is returned

来自 man(2) 写:

Upon successful completion the number of bytes which were written is returned

现在涉及:

Can I be more specific and designate the # of chars read/write reads in an argument? If so, how?

AFAIK 不,但可能有一些特定于设备/内核的方法,例如 ioctl(2)

关于c - 找出读取/写入读取的字符数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25645355/

相关文章:

c - 是否保证全局变量总是用c99初始化为0?

MATLAB C/MEX 中的转换问题

c - 计算 CRC16 校验和的函数

c - if方法中为什么不清屏(仅限C语言)

c++ - 使用C++将不规则文件读入二维数组

ruby - #tty 是什么?在 STDIN 上意味着/在 ruby​​ 中做什么?

java - 用 Java 写入文件 : Cannot find the path specified

c - 如何访问共享内存中的变量

c - 修改linux中的bio结构

c++ - 内联汇编,输出指令