当前位置:网站首页>Read stream special attention
Read stream special attention
2022-06-22 03:55:00 【Hongdayu】
If read() Not all the data in the message was retrieved , Then the remaining data should be left in STREAM in , And you can pass the next read() Call to retrieve . Information -
Discard patterns also retrieve data , Until the requested number of bytes is transmitted , Or the message boundary is reached . However , Unread data remains in a
read() The returned message will be discarded , And cannot be used for subsequent read()、getmsg() or getpmsg() call .
read() How to handle zero bytes STREAMS The message is determined by the current read mode setting . In byte stream mode ,read() Will accept data , Until it reads
nbyte byte , Or until there is no more data to read , Or until a zero byte message block is encountered . then read() The number that the function should return
Number of bytes read , And put the zero byte message back STREAM On , For the next read()、getmsg() or getpmsg() retrieval . In the message do not drop mode or message
sage-discard Pattern , A zero byte message should return 0, And the message should be from STREAM Delete in . When a zero byte message is read as the first message
stay STREAM On , Regardless of the read mode , Should be STREAM Delete the message and return 0.
come from STREAMS Of documents read() Should be in STREAM The header reads the data in the message returned from the front of the queue , Regardless of the priority band of the message .
By default ,STREAM In control normal mode , One is from STREAMS Of documents read() Can only process parts that contain data but do not contain
control section . If in STREAM The header encountered a message containing a control part ,read() Will fail . This default action can be done by placing
Use I_SRDOPT ioctl() The command is executed in control data mode or control discard mode STREAM. In control data mode ,read() Any control part shall be converted to
Data and pass it to the application , Then pass any data parts that originally existed in the same message . In control discard mode ,read() Message will be discarded
control section , But return any data part of the message to the process .
Besides , If STREAM The header handled an asynchronous error before the call , be read() Will fail . under these circumstances ,errno The value of should not reflect
read() Result , But it reflects a previous mistake . If you are reading STREAM A hang occurred ,read() Will continue to operate normally , until STREAM head
The read queue is empty . thereafter , It will return 0.
pread() The function should be equivalent to read(), Except that it should read from a given location in the file without changing the file pointer . First
pread() The three parameters of read() identical , Just add a fourth parameter offset for the desired location in the file . Trying to perform
Could not find... On file pread() Will lead to mistakes .
Return value
After successful completion , These functions should return a nonnegative integer , Indicates the number of bytes actually read . otherwise , Function should
return -1 And set up errno To indicate an error .
边栏推荐
- The following assertion was thrown during performlayout
- LeetCode --- 1221. Split a string in balanced strings problem solving Report
- Contact and understanding in PowerDesigner CDM
- 首个女性向3A手游要来了?获IGN认可,《以闪亮之名》能否突出重围
- Use of shutter stream
- WebView error
- IIR滤波器设计基础及Matlab设计示例
- Cloud native architecture (02) - what is cloud native
- Comment dart asynchrone est implémenté
- LeetCode --- 1221. Split a String in Balanced Strings 解题报告
猜你喜欢

Code of ultrasonic rangefinder based on 51 (screenshot version)

How far is the memory computing integrated chip from popularization? Listen to what practitioners say | collision school x post friction intelligence

Solend闹剧背后的「DeFi道德悖论」

3DE position of moving object

A solution to the conflict between the keywords of DM data and the fields of the table

NLog自定义Target之MQTT

倍福Twincat NC PTP使用介绍

Flutter performance optimization

动态规划-使用最小花费爬楼梯为例

未来已来:云原生时代
随机推荐
【写文章神器】标记语言Markdown的使用
The difference between quick failure and safe failure
Kubernetes 集群日志管理
WebView error
3DE save to Favorites
Ads communication between Beifu twincat3 controller and controller
How to randomly assign 1000 to 10 numbers
详细专业的软件功能测试报告应该怎样书写
便捷自在掌握,vivo智能遥控功能实现全屋家电控制
Official competition volume and "answer" of "Cyberspace Security" of secondary vocational group in 2019 national vocational college skills competition
The "two lives" I spent in Huawei (learning from those who performed well in large factories)
[leetcode] 17 backtracking (letter combination of telephone number)
快速掌握 ASP.NET 身份认证框架 Identity - 用户注册
ORA-32700: error occurred in DIAG Group Service
积加ERP全局参数灵活配置成本取值规则,核算全面到位
GDB commissioning, use and sorting
Mysql 45讲学习笔记(二)SQL更新语句的执行
Larave 数据库备份 定时任务
未来已来:云原生时代
MySQL 45 lecture learning notes (II) execution of SQL update statements