⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fopen.3

📁 Unix操作系统minix 2.0源码
💻 3
字号:
%!PS-Adobe-1.0%%Creator: devps (Pipeline Associates, Inc.)%%CreationDate: Fri Sep 13 13:06:41 1996%%Pages: (atend)%%DocumentFonts: (atend)/devps 180 dict def devps begin/res 10.000000 def/y_offset 843 def/X{exch}bind def/mm {transform round X round X itransform} bind def/r{rmoveto}bind def/m{moveto}bind def/l{lineto}bind def/rl{rlineto}bind def/st{stroke}bind def/gs{gsave}bind def/gr{grestore}bind def/cp{currentpoint}bind def/np{newpath}bind def/ct{curveto}bind defsystemdict /setpacking known { /savepacking currentpacking def true setpacking } if/m0{0 0 moveto}bind def/xc{//res div}bind def/yc{//res neg div //y_offset add}bind def/lc{yc X xc X l st}bind def/mc{yc X xc X m}bind def/el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}bind def/ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}bind def/sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}bind def/V{//res neg div //y_offset addcurrentpoint pop Xm}bind def/H{//res div0 transform X round X itransform popcurrentpoint X popmoveto}bind def/h{//res div 0 r}bind def/v{//res neg div 0 X r}bind def/S{X H show}bind def/A{H //res div 1 index stringwidth pop sub 1 index length div 0 3 2 roll ashow}bind def/psize 10 def/height 0 def/cheight { height 0 ne { height } { psize } ifelse } bind def/slant 0 def/FF{findfont X dup 30 div 0 mm pop setlinewidth /psize X def    [psize 0 cheight slant sin slant cos div mul cheight 0 0]    makefont setfont}bind def/shade{gs /dy X def /dx X def np m 0 /dy rl /dx 0 rl 0 /dy neg rl /dx neg 0 rl closepath .9 setgray fillgr}bind def1 setlinecap/resolution res 72 mul def/startFig {	/SavedState save def	userdict maxlength dict begin	currentpoint transform	DocumentInitState setmiterlimit setgray setdash setlinejoin setlinecap		setlinewidth setmatrix	itransform moveto	/ury exch def	/urx exch def	/lly exch def	/llx exch def	/y exch 72 mul resolution div def	/x exch 72 mul resolution div def		currentpoint /cy exch def /cx exch def	/sx x urx llx sub div def	/sy y ury lly sub div def	sx sy scale	cx sx div llx sub	cy sy div ury sub translate		/DefFigCTM matrix currentmatrix def	/initmatrix {		DefFigCTM setmatrix	} def	/defaultmatrix {		DefFigCTM exch copy	} def	/initgraphics {		DocumentInitState setmiterlimit setgray setdash 			setlinejoin setlinecap setlinewidth setmatrix		DefFigCTM setmatrix	} def	/showpage {		initgraphics	} def}bind  def/clipFig {	currentpoint 6 2 roll	newpath 4 copy	4 2 roll moveto	6 -1 roll exch lineto	exch lineto	exch lineto	closepath clip	newpath	moveto}bind  def/doclip { llx lly urx ury clipFig } def/endFig {	end SavedState restore}bind  def/globalstart {	fontnum psize slant height resolution currentpoint 	pagesave restore gsave }bind  def/globalend {	grestore moveto	/resolution exch def /height exch def	/slant exch def /psize exch def /fontnum exch def	F	/pagesave save def}bind  def/fontnum 1 def systemdict /setpacking known { savepacking setpacking} ifend/BP{save mark devps begin m0/DocumentInitState [ matrix currentmatrix currentlinewidth currentlinecapcurrentlinejoin currentdash currentgray currentmiterlimit ] cvx def}bind def/EP{end cleartomark restore showpage}def/Encoding-1 256 array def0 1 255 {Encoding-1 exch /.notdef put} forEncoding-1 8#301 StandardEncoding 8#101 26 getinterval putinterval %A-BEncoding-1 8#341 StandardEncoding 8#141 26 getinterval putinterval %a-bEncoding-1 8#241 StandardEncoding 8#301 16 getinterval putinterval %accentsEncoding-1 8#373 StandardEncoding 8#365 1 getinterval putinterval %dotlessiEncoding-1dup 8#41 /copyright putdup 8#42 /registered putdup 8#43 /trademark putdup 8#44 /logicalnot putdup 8#45 /Eth putdup 8#46 /eth putdup 8#47 /Thorn putdup 8#50 /thorn putdup 8#51 /brokenbar putdup 8#52 /degree putdup 8#53 /divide putdup 8#54 /multiply putdup 8#55 /minus putdup 8#56 /onehalf putdup 8#57 /onequarter putdup 8#60 /threequarters putdup 8#101 /Aacute putdup 8#102 /Acircumflex putdup 8#103 /Adieresis putdup 8#104 /Agrave putdup 8#105 /Aring putdup 8#106 /Atilde putdup 8#107 /Ccedilla putdup 8#110 /Eacute putdup 8#111 /Ecircumflex putdup 8#112 /Edieresis putdup 8#113 /Egrave putdup 8#114 /Iacute putdup 8#115 /Icircumflex putdup 8#116 /Idieresis putdup 8#117 /Igrave putdup 8#120 /Ntilde putdup 8#121 /Oacute putdup 8#122 /Ocircumflex putdup 8#123 /Odieresis putdup 8#124 /Ograve putdup 8#125 /Otilde putdup 8#126 /Scaron putdup 8#127 /Uacute putdup 8#130 /Ucircumflex putdup 8#131 /Udieresis putdup 8#132 /Ugrave putdup 8#133 /Ydieresis putdup 8#134 /Zcaron putdup 8#135 /aacute putdup 8#136 /acircumflex putdup 8#137 /adieresis putdup 8#140 /agrave putdup 8#141 /aring putdup 8#142 /atilde putdup 8#143 /ccedilla putdup 8#144 /eacute putdup 8#145 /ecircumflex putdup 8#146 /edieresis putdup 8#147 /egrave putdup 8#150 /iacute putdup 8#151 /icircumflex putdup 8#152 /idieresis putdup 8#153 /igrave putdup 8#154 /ntilde putdup 8#155 /oacute putdup 8#156 /ocircumflex putdup 8#157 /odieresis putdup 8#160 /ograve putdup 8#161 /otilde putdup 8#162 /scaron putdup 8#163 /uacute putdup 8#164 /ucircumflex putdup 8#165 /udieresis putdup 8#166 /ugrave putdup 8#167 /ydieresis putdup 8#170 /zcaron putpop/Enc-dict 30 dict defEnc-dict /tmpstr1 50 string putEnc-dict /tmpstr2 50 string putEnc-dict /tmpstr3 50 string dup (Encoding-) exch cvs pop put/AEnc-def { % arguments: the original font's name, encoding nrEnc-dict begintmpstr2 cvs /Enc-no exch def % Remember the number in a stringdup /OrigName exch def % remember the namefindfont dup maxlength dict /newdict exch def % get dictionary for new font{ exch dup /FID ne   { exch newdict 3 1 roll put }   { pop pop } % Ignore FID   ifelse} forallnewdict begin/Encoding  tmpstr3 9 Enc-no putinterval tmpstr3 0 9 Enc-no length add getinterval  cvn load  def % Replace encodingcurrentdict /UniqueID known{ /UniqueID UniqueID Enc-no cvi 49999 mul add def } if % Derive New UniqueIDend % newdict/FNlength OrigName tmpstr1 cvs length def % convert name, remember lengthFNlength 1 add Enc-no length add stringdup 0 OrigName tmpstr1 cvs putintervaldup FNlength (-) putintervaldup FNlength 1 add Enc-no putintervaldup 0 tmpstr1 0 FNlength getinterval putinterval % Add old namecvn dup newdict /FontName 3 2 roll put newdict definefontend % Enc-dict} def/Times-Roman 1 AEnc-def pop/R-1{/Times-Roman-1 FF}def/R{/Times-Roman FF}def/B{/Times-Bold FF}def/I{/Times-Italic FF}def%%EndProlog%%Page: 1 1BP/slant 0 def/height 0 def480 V10 R720(FOPEN)S1048(\()S1090(3)S1148(\))S2696(Eighth)S(Edition)296 2989 A4799(FOPEN)S5127(\()S5169(3)S5227(\))S960 V9 R720(N)S722(NA)S790(AM)S858(ME)S940(E)S1080 V10 R1080(fopen,)S1359(freopen,)S(fdopen)279 1717 A10 R-12021(-)S10 R2103(open)S2323(a)S2393(stream)S1248 V9 R720(S)S722(SY)S774(YN)S842(NO)S910(OP)S978(PS)S1030(SI)S1082(IS)S1115(S)S1368 V10 B1080(#include)S1482(<stdio.h>)S1608 V1080(FILE)S1353(*fopen\(const)S1940(char)S2174(*)S10 I2224(\256lename)S10 B2565(,)S2628(const)S2890(char)S3124(*)S10 I3174(type)S10 B3342(\))S1728 V1080(FILE)S1353(*freopen\(const)S2030(char)S2264(*)S10 I2314(\256lename)S10 B2655(,)S2718(const)S2980(char)S3214(*)S10 I3264(type)S10 B3432(,)S3495(FILE)S3768(*)S10 I3818(stream)S10 B4092(\))S1848 V1080(FILE)S1353(*fdopen\(int)S10 I1890(\256ldes)S10 B2102(,)S2165(const)S2427(char)S2661(*)S10 I2711(type)S10 B2879(\))S2016 V9 R720(D)S722(DE)S790(ES)S848(SC)S900(CR)S962(RI)S1024(IP)S1057(PT)S1109(TI)S1167(IO)S1200(ON)S1268(N)S2136 V10 B1080(Fopen)S10 R1377(opens)S1639(the)S1790(\256le)S1947(named)S2244(by)S10 I2373(\256lename)S10 R2743(and)S2917(associates)S3349(a)S3423(stream)S3721(with)S3929(it.)S10 B4064(Fopen)S10 R4362(returns)S4671(a)S4745(pointer)S5059(to)S5166(be)S2256 V1080(used)S1289(to)S1392(identify)S1730(the)S1878(stream)S2172(in)S2275(subsequent)S2746(operations.)S2424 V10 I1080(Type)S10 R1301(is)S1393(a)S1463(character)S1859(string)S2113(having)S2411(one)S2581(of)S2690(the)S2838(following)S3254(values:)S2592 V1080("r")S1330(open)S1550(for)S1693(reading)S2760 V1080("w")S1330(create)S1597(for)S(writing)291 1740 A2928 V1080("a")S1330(append:)S1673(open)S1893(for)S(writing)291 2036 A2352(at)S2450(end)S2620(of)S2729(\256le,)S2908(or)S3017(create)S3284(for)S(writing)291 3427 A3096 V1080(In)S(addition,)354 1195 A(each)185 1580 A10 I1796(type)S10 R1995(may)S2199(be)S2325(followed)S2714(by)S2845(a)S2921("+")S3091(to)S3200(have)S3421(the)S3575(\256le)S3735(opened)S4056(for)S4205(reading)S4538(and)S(writing.)316 4715 A5088("r+")S3216 V(positions)362 1080 A1469(the)S1619(stream)S1915(at)S2015(the)S2165(beginning)S2593(of)S2704(the)S2854(\256le,)S3035("w+")S3274(creates)S3581(or)S3691(truncates)S4081(it,)S4188(and)S4359("a+")S(positions)362 4569 A4957(it)S5039(at)S5138(the)S3336 V1080(end.)S1319(Both)S1558(reads)S1815(and)S2004(writes)S2295(may)S2512(be)S2651(used)S2879(on)S3023(read/write)S3477(streams,)S3854(with)S4077(the)S4245(limitation)S4681(that)S4877(an)S10 B5017(fseek)S10 R5236(,)S3456 V10 B1080(rewind)S10 R1383(,)S1433(or)S1542(reading)S1869(an)S1989(end-of-\256le)S2440(must)S2660(be)S2780(used)S2989(between)S3350(a)S3420(read)S3619(and)S3789(a)S3859(write)S4092(or)S4201(vice-versa.)S3624 V10 B1080(Freopen)S10 R(substitutes)424 1466 A1917(the)S2067(named)S2362(\256le)S2518(in)S(place)213 2623 A2863(of)S2974(the)S3124(open)S10 I3346(stream)S10 R3628(.)S3706(It)S3796(returns)S4104(the)S4255(original)S4596(value)S4842(of)S10 I4954(stream)S10 R5236(.)S3744 V1080(The)S1262(original)S1600(stream)S1894(is)S1986(closed.)S3912 V10 B1080(Freopen)S10 R1473(is)S1574(typically)S1960(used)S2178(to)S2290(attach)S2565(the)S2723(preopened)S3177(constant)S3547(names,)S10 B3864(stdin,)S4137(stdout,)S(stderr,)289 4466 A10 R4790(to)S4903(speci\256ed)S4032 V1080(\256les.)S4200 V10 B1080(Fdopen)S10 R1430(associates)S1858(a)S1928(stream)S2222(with)S2426(a)S2496(\256le)S2651(descriptor)S3080(obtained)S3452(from)S10 B3674(open)S10 R3881(,)S10 B(dup)168 3932 A10 R4100(,)S10 B(creat)219 4151 A10 R4370(,)S4421(or)S10 B4531(pipe)S10 R4716(\(2\).)S4910(The)S10 I5093(type)S4320 V10 R1080(of)S1189(the)S1337(stream)S1631(must)S1851(agree)S2095(with)S2299(the)S2447(mode)S2695(of)S2804(the)S2952(open)S3172(\256le.)S4488 V9 R720(S)S722(SE)S774(EE)S832(E)S913(A)S915(AL)S983(LS)S1041(SO)S1093(O)S4608 V10 B1080(open)S10 R1287(\(2\),)S10 B1455(fclose)S10 R1696(\(3\).)S4776 V9 R720(D)S722(DI)S790(IA)S823(AG)S891(GN)S959(NO)S1027(OS)S1095(ST)S1147(TI)S1205(IC)S1238(CS)S1300(S)S4896 V10 B1080(Fopen)S10 R1392(and)S10 B1580(freopen)S10 R1954(return)S2238(the)S2404(pointer)S9 B2730(NULL)S10 R3025(if)S10 I3130(\256lename)S10 R(cannot)268 3514 A3825(be)S(accessed,)378 3963 A4384(if)S4489(too)S4660(many)S4926(\256les)S5137(are)S5016 V1080(already)S1402(open,)S1647(or)S1756(if)S1843(other)S2075(resources)S2481(needed)S(cannot)268 2791 A3084(be)S3204(allocated.)S5184 V9 R720(B)S722(BU)S784(UG)S852(GS)S920(S)S5304 V10 B1080(Fdopen)S10 R1430(is)S1522(not)S1675(portable)S2030(to)S2133(systems)S2476(other)S2708(than)S2906(UNIX.)S5472 V1080(The)S1270(read/write)S10 I1713(types)S10 R1953(do)S2086(not)S2247(exist)S2470(on)S2603(all)S2737(systems.)S3139(Those)S3419(systems)S(without)307 3771 A4112(read/write)S4556(modes)S(will)157 4852 A5043(prob-)S5592 V1080(ably)S1278(treat)S1483(the)S10 I1631(type)S10 R1824(as)S1933(if)S2020(the)S2168("+")S2332(was)S2514(not)S2667(present.)S3033(These)S3299(are)S3448(unreliable)S3876(in)S3979(any)S4149(event.)S7903 V720(Page)S941(1)S2669(\()S2711(May)S2920(27,)S(1986)200 3070 A3278(\))S4455(September)S4911(13,)S(1996)200 5061 A8143 VEP%%Trailer%%DocumentFonts: Times-Roman Times-Bold Times-Italic%%Pages: 1

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -