Skip to Content
C语言核心技术(原书第2版)
book

C语言核心技术(原书第2版)

by Peter Prinz, Tony Crawford
August 2017
Intermediate to advanced
798 pages
17h 44m
Chinese
China Machine Press
Content preview from C语言核心技术(原书第2版)
618
|
第
18
章
return -1;
//
存储并处理数据
return process_data(); //
如果
tss_create()
设置了析构函数,返回调用它
}
相关函数
tss_get()
、
tss_create()
、
tss_delete()
。
ungetc
将一个字符写入一个文件缓冲区,以供后续读取。
#include <stdio.h>
int
ungetc
( int
c
, FILE
*fp
);
函数
ungetc()
的作用与
getc()
相反
,它将字符
c
写入
FILE
指针
fp
所指向的文件缓冲区,
使得在后续的读取操作时,第一个被读到的字符就是
c
。(然而,如果程序在再次读取
文件以前,成功调用了
fseek()
、
fsetpos()
或
rewind()
,则
ungetc()
所写
入的字符就会
遗失。)
ungetc()
函
数不会改变磁盘中文件的内容。
你可以使用
unget()
对文件缓冲区写入至少一个字符。可以进行连续多次地调用,但
其间如果没有读取操作,则不能确保
unget()
写入
操作一定成功。如果连续成功调用
unget()
,
那么被写入的字符将是采用后入先出次序。
如果操作成功,函数
ungetc()
返回被写入到文件缓冲区的字符,并清除该文件的
EOF
标
记。如果操作失败,函数
ungetc()
返回
EOF
。不得对文件缓冲区写入一个
EOF
值。
与
fp
关联的文件必须以文本或二进制模式打开,以供读取操作。如果该文件是文本模
式,则
ungetc()
会把文件访问位置指示器设置为未定义状态,直到所有被写入的字符再 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

算法精讲视频课程:24篇系列讲座

算法精讲视频课程:24篇系列讲座

罗伯特·塞奇威克, 凯文·韦恩(Kevin Wayne)

Publisher Resources

ISBN: 9787111562207