File: perlapio.html

package info (click to toggle)
perl-doc-html 5.26.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 39,400 kB
  • sloc: xml: 36; makefile: 7
file content (858 lines) | stat: -rw-r--r-- 52,312 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <title>perlapio - perldoc.perl.org</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta http-equiv="Content-Language" content="en-gb">
  <link rel="search" type="application/opensearchdescription+xml" title="Search perldoc.perl.org" href="/static/search.xml"/>
  <link href="static/css-20100830.css" rel="stylesheet" rev="stylesheet" type="text/css" media="screen">
  <link href="static/exploreperl.css" rel="stylesheet" rev="stylesheet" type="text/css">
</head>

<body onLoad="perldoc.startup();" onPageShow="if (event.persisted) perldoc.startup();">
    <div id="page">
      
      <div id="header">
	<div id="homepage_link">
	  <a href="index.html"></a>
	</div>
	<div id="strapline">
	  Perl Programming Documentation
	</div>
	<div id="download_link" class="download">
	  <a href="http://www.perl.org/get.html">Download Perl</a>
	</div>
	<div id="explore_link" class="download">
	  <a id="explore_anchor" href="#">Explore</a>
	</div>
      </div>
      
      <div id="body">
        <div id="left_column">
          <div class="side_group">
            
	    <div class="side_panel doc_panel">
              <p>Manual</p>
              <ul>
                <li><a href="index-overview.html">Overview</a>
                <li><a href="index-tutorials.html">Tutorials</a>
                <li><a href="index-faq.html">FAQs</a>
                <li><a href="index-history.html">History / Changes</a>
                <li><a href="index-licence.html">License</a>
              </ul>
            </div>
            <div class="side_panel doc_panel">
              <p>Reference</p>
              <ul>
                <li><a href="index-language.html">Language</a>
                <li><a href="index-functions.html">Functions</a>
                <li><a href="perlop.html">Operators</a>
                <li><a href="perlvar.html">Special Variables</a>
                <li><a href="index-pragmas.html">Pragmas</a>
                <li><a href="index-utilities.html">Utilities</a>
                <li><a href="index-internals.html">Internals</a>
                <li><a href="index-platforms.html">Platform Specific</a>
              </ul>
            </div>
            <div class="side_panel doc_panel">
              <p>Modules</p>
              <ul>
		<li>
		
                
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		
                  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		
                  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		    
		  
		
                  
		
                  
		
                  
		    
		  
		
                  
		
                  
		
		
                    <a href="index-modules-A.html">A</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-B.html">B</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-C.html">C</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-D.html">D</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-E.html">E</a>
                    
                      
                        <li>
                      
                    
                
                    <a href="index-modules-F.html">F</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-G.html">G</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-H.html">H</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-I.html">I</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-L.html">L</a>
                    
                      
                        <li>
                      
                    
                
                    <a href="index-modules-M.html">M</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-N.html">N</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-O.html">O</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-P.html">P</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-S.html">S</a>
                    
                      
                        <li>
                      
                    
                
                    <a href="index-modules-T.html">T</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-U.html">U</a>
                    
                      
                        &bull;
                      
                    
                
                    <a href="index-modules-X.html">X</a>
                    
                
              </ul>
            </div>
            
	      <div class="side_panel doc_panel">
		<p>Tools</p>
		<ul>
		  <li><a href="preferences.html">Preferences</a>
		</ul>
	      </div>
            
          </div>
        </div>
        <div id="centre_column">
          <div id="content_header">
            <div id="title_bar">
              <div id="page_name">
                <h1>perlapio</h1>
              </div>
              <div id="perl_version">
                Perl 5 version 26.0 documentation
              </div>
              <div class="page_links" id="page_links_top">
                <a href="#" onClick="toolbar.goToTop();return false;">Go to top</a>
		
              </div>
	      <div class="page_links" id="page_links_bottom">
		
                  <a href="#" id="page_index_toggle">Show page index</a> &bull;
		
                <a href="#" id="recent_pages_toggle">Show recent pages</a>		
	      </div>
	      <div id="search_form">
		<form action="search.html" method="GET" id="search">
		  <input type="text" name="q" id="search_box" alt="Search">
		</form>
	      </div>
            </div>
            <div id="breadcrumbs">
                
    <a href="index.html">Home</a> &gt;
    
      
        <a href="index-internals.html">Internals and C language interface</a> &gt;
      
    
    perlapio
  

            </div>
          </div>
          <div id="content_body">
	    <!--[if lt IE 7]>
 <div class="noscript">
   <p>
     <strong>It looks like you're using Internet Explorer 6. This is a very old
     browser which does not offer full support for modern websites.</strong>
   </p>
   <p>
     Unfortunately this means that this website will not work on
     your computer.
   </p>
   <p>
     Don't miss out though! To view the site (and get a better experience from
     many other websites), simply upgrade to
     <a href="http://www.microsoft.com/windows/Internet-explorer/default.aspx">Internet
Explorer 8</a>
     or download an alternative browser such as
     <a href="http://www.mozilla.com/en-US/firefox/firefox.html">Firefox</a>,
     <a href="http://www.apple.com/safari/download/">Safari</a>, or
     <a href="http://www.google.co.uk/chrome">Google Chrome</a>.
   </p>
   <p>
     All of these browsers are free. If you're using a PC at work, you may
     need to contact your IT administrator.
   </p>
 </div>
<![endif]-->
	    <noscript>
	      <div class="noscript">
	      <p>
                <strong>Please note: Many features of this site require JavaScript. You appear to have JavaScript disabled,
	        or are running a non-JavaScript capable web browser.</strong>
	      </p>
	      <p>
		To get the best experience, please enable JavaScript or download a modern web browser such as <a href="http://www.microsoft.com/windows/Internet-explorer/default.aspx">Internet Explorer 8</a>, <a href="http://www.mozilla.com/en-US/firefox/firefox.html">Firefox</a>, <a href="http://www.apple.com/safari/download/">Safari</a>, or <a href="http://www.google.co.uk/chrome">Google Chrome</a>.
              </p>
	      </div>
	    </noscript>

	    <div id="recent_pages" class="hud_container">
	      <div id="recent_pages_header" class="hud_header">
		<div id="recent_pages_close" class="hud_close"><a href="#" onClick="recentPages.hide();return false;"></a></div>
		<div id="recent_pages_title" class="hud_title"><span class="hud_span_top">Recently read</span></div>
		<div id="recent_pages_topright" class="hud_topright"></div>
	      </div>
	      <div id="recent_pages_content" class="hud_content">
	      </div>
	      <div id="recent_pages_footer" class="hud_footer">
		<div id="recent_pages_bottomleft" class="hud_bottomleft"></div>
		<div id="recent_pages_bottom" class="hud_bottom"><span class="hud_span_bottom"></span></div>
		<div id="recent_pages_resize" class="hud_resize"></div>
	      </div>
	    </div>
  
	    <div id="from_search"></div>
            <h1>perlapio</h1>


  <!--    -->
<ul><li><a href="#NAME">NAME</a><li><a href="#SYNOPSIS">SYNOPSIS</a><li><a href="#DESCRIPTION">DESCRIPTION</a><ul><li><a href="#Co-existence-with-stdio">Co-existence with stdio</a><li><a href="#%22Fast-gets%22-Functions">"Fast gets" Functions</a><li><a href="#Other-Functions">Other Functions</a></ul></ul><a name="NAME"></a><h1>NAME</h1>
<p>perlapio - perl's IO abstraction interface.</p>
<a name="SYNOPSIS"></a><h1>SYNOPSIS</h1>
<pre class="verbatim"><ol><li>  <span class="c">#define PERLIO_NOT_STDIO 0    /* For co-existence with stdio only */</span></li><li>  <span class="c">#include &lt;perlio.h&gt;           /* Usually via #include &lt;perl.h&gt; */</span></li><li></li><li>  <span class="w">PerlIO</span> *<span class="i">PerlIO_stdin</span><span class="s">(</span><span class="w">void</span><span class="s">)</span><span class="sc">;</span></li><li>  <span class="w">PerlIO</span> *<span class="i">PerlIO_stdout</span><span class="s">(</span><span class="w">void</span><span class="s">)</span><span class="sc">;</span></li><li>  <span class="w">PerlIO</span> *<span class="i">PerlIO_stderr</span><span class="s">(</span><span class="w">void</span><span class="s">)</span><span class="sc">;</span></li><li></li><li>  <span class="w">PerlIO</span> *<span class="i">PerlIO_open</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">path</span><span class="cm">,</span><span class="w">const</span> <span class="w">char</span> *<span class="w">mode</span><span class="s">)</span><span class="sc">;</span></li><li>  <span class="w">PerlIO</span> *<span class="i">PerlIO_fdopen</span><span class="s">(</span><a class="l_k" href="functions/int.html">int</a> <span class="w">fd</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">mode</span><span class="s">)</span><span class="sc">;</span></li><li>  <span class="w">PerlIO</span> *<span class="i">PerlIO_reopen</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">path</span><span class="cm">,</span> <span class="q">/* deprecated */</span></li><li>          <span class="w">const</span> <span class="w">char</span> *<span class="w">mode</span><span class="cm">,</span> <span class="w">PerlIO</span> *<span class="w">old</span><span class="s">)</span><span class="sc">;</span></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_close</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="s">)</span><span class="sc">;</span></li><li></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_stdoutf</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">fmt</span><span class="cm">,</span>...<span class="s">)</span></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_puts</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="cm">,</span><span class="w">const</span> <span class="w">char</span> *<span class="w">string</span><span class="s">)</span><span class="sc">;</span></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_putc</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="cm">,</span><a class="l_k" href="functions/int.html">int</a> <span class="w">ch</span><span class="s">)</span><span class="sc">;</span></li><li>  <span class="w">SSize_t</span> <span class="i">PerlIO_write</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="cm">,</span><span class="w">const</span> <span class="w">void</span> *<span class="w">buf</span><span class="cm">,</span><span class="w">size_t</span> <span class="w">numbytes</span><span class="s">)</span><span class="sc">;</span></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_printf</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">fmt</span><span class="cm">,</span>...<span class="s">)</span><span class="sc">;</span></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_vprintf</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">fmt</span><span class="cm">,</span> <span class="w">va_list</span> <span class="w">args</span><span class="s">)</span><span class="sc">;</span></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_flush</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="s">)</span><span class="sc">;</span></li><li></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_eof</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="s">)</span><span class="sc">;</span></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_error</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="s">)</span><span class="sc">;</span></li><li>  <span class="w">void</span>    <span class="i">PerlIO_clearerr</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="s">)</span><span class="sc">;</span></li><li></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_getc</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">d</span><span class="s">)</span><span class="sc">;</span></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_ungetc</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="cm">,</span><a class="l_k" href="functions/int.html">int</a> <span class="w">ch</span><span class="s">)</span><span class="sc">;</span></li><li>  <span class="w">SSize_t</span> <span class="i">PerlIO_read</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="cm">,</span> <span class="w">void</span> *<span class="w">buf</span><span class="cm">,</span> <span class="w">size_t</span> <span class="w">numbytes</span><span class="s">)</span><span class="sc">;</span></li><li></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_fileno</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="s">)</span><span class="sc">;</span></li><li></li><li>  <span class="w">void</span>    <span class="i">PerlIO_setlinebuf</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="s">)</span><span class="sc">;</span></li><li></li><li>  <span class="w">Off_t</span>   <span class="i">PerlIO_tell</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="s">)</span><span class="sc">;</span></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_seek</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="cm">,</span> <span class="w">Off_t</span> <span class="w">offset</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">whence</span><span class="s">)</span><span class="sc">;</span></li><li>  <span class="w">void</span>    <span class="i">PerlIO_rewind</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="s">)</span><span class="sc">;</span></li><li></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_getpos</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">save</span><span class="s">)</span><span class="sc">;</span>    <span class="q">/* prototype changed */</span></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_setpos</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="cm">,</span> <span class="w">SV</span> *<span class="w">saved</span><span class="s">)</span><span class="sc">;</span>   <span class="q">/* prototype changed */</span></li><li></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_fast_gets</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="s">)</span><span class="sc">;</span></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_has_cntptr</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="s">)</span><span class="sc">;</span></li><li>  <span class="w">SSize_t</span> <span class="i">PerlIO_get_cnt</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="s">)</span><span class="sc">;</span></li><li>  <span class="w">char</span>   *<span class="i">PerlIO_get_ptr</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="s">)</span><span class="sc">;</span></li><li>  <span class="w">void</span>    <span class="i">PerlIO_set_ptrcnt</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="cm">,</span> <span class="w">char</span> *<span class="w">ptr</span><span class="cm">,</span> <span class="w">SSize_t</span> <span class="w">count</span><span class="s">)</span><span class="sc">;</span></li><li></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_canset_cnt</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="s">)</span><span class="sc">;</span>              <span class="q">/* deprecated */</span></li><li>  <span class="w">void</span>    <span class="i">PerlIO_set_cnt</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">count</span><span class="s">)</span><span class="sc">;</span>      <span class="q">/* deprecated */</span></li><li></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_has_base</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="s">)</span><span class="sc">;</span></li><li>  <span class="w">char</span>   *<span class="i">PerlIO_get_base</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="s">)</span><span class="sc">;</span></li><li>  <span class="w">SSize_t</span> <span class="i">PerlIO_get_bufsiz</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="s">)</span><span class="sc">;</span></li><li></li><li>  <span class="w">PerlIO</span> *<span class="i">PerlIO_importFILE</span><span class="s">(</span><span class="w">FILE</span> *<span class="w">stdio</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">mode</span><span class="s">)</span><span class="sc">;</span></li><li>  <span class="w">FILE</span>   *<span class="i">PerlIO_exportFILE</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">flags</span><span class="s">)</span><span class="sc">;</span></li><li>  <span class="w">FILE</span>   *<span class="i">PerlIO_findFILE</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="s">)</span><span class="sc">;</span></li><li>  <span class="w">void</span>    <span class="i">PerlIO_releaseFILE</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="cm">,</span><span class="w">FILE</span> *<span class="w">stdio</span><span class="s">)</span><span class="sc">;</span></li><li></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_apply_layers</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="cm">,</span> <span class="w">const</span> <span class="w">char</span> *<span class="w">mode</span><span class="cm">,</span></li><li>                                                    <span class="w">const</span> <span class="w">char</span> *<span class="w">layers</span><span class="s">)</span><span class="sc">;</span></li><li>  <a class="l_k" href="functions/int.html">int</a>     <span class="i">PerlIO_binmode</span><span class="s">(</span><span class="w">PerlIO</span> *<span class="w">f</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">ptype</span><span class="cm">,</span> <a class="l_k" href="functions/int.html">int</a> <span class="w">imode</span><span class="cm">,</span></li><li>                                                    <span class="w">const</span> <span class="w">char</span> *<span class="w">layers</span><span class="s">)</span><span class="sc">;</span></li><li>  <span class="w">void</span>    <span class="i">PerlIO_debug</span><span class="s">(</span><span class="w">const</span> <span class="w">char</span> *<span class="w">fmt</span><span class="cm">,</span>...<span class="s">)</span></li></ol></pre><a name="DESCRIPTION"></a><h1>DESCRIPTION</h1>
<p>Perl's source code, and extensions that want maximum portability,
should use the above functions instead of those defined in ANSI C's
<i>stdio.h</i>.  The perl headers (in particular "perlio.h") will
<code class="inline"><span class="c">#define</span></code>
 them to the I/O mechanism selected at Configure time.</p>
<p>The functions are modeled on those in <i>stdio.h</i>, but parameter order
has been "tidied up a little".</p>
<p><code class="inline"><span class="w">PerlIO</span> *</code>
 takes the place of FILE *. Like FILE * it should be
treated as opaque (it is probably safe to assume it is a pointer to
something).</p>
<p>There are currently three implementations:</p>
<dl>
<dt>1. </dt><dd><a name="1.-USE_STDIO"></a><b>USE_STDIO</b>
<p>All above are #define'd to stdio functions or are trivial wrapper
functions which call stdio. In this case <i>only</i> PerlIO * is a FILE *.
This has been the default implementation since the abstraction was
introduced in perl5.003_02.</p>
</dd>
<dt>2. </dt><dd><a name="2.-USE_PERLIO"></a><b>USE_PERLIO</b>
<p>Introduced just after perl5.7.0, this is a re-implementation of the
above abstraction which allows perl more control over how IO is done
as it decouples IO from the way the operating system and C library
choose to do things. For USE_PERLIO PerlIO * has an extra layer of
indirection - it is a pointer-to-a-pointer.  This allows the PerlIO *
to remain with a known value while swapping the implementation around
underneath <i>at run time</i>. In this case all the above are true (but
very simple) functions which call the underlying implementation.</p>
<p>This is the only implementation for which <code class="inline"><span class="i">PerlIO_apply_layers</span><span class="s">(</span><span class="s">)</span></code>

does anything "interesting".</p>
<p>The USE_PERLIO implementation is described in <a href="perliol.html">perliol</a>.</p>
</dd>
</dl>
<p>Because "perlio.h" is a thin layer (for efficiency) the semantics of
these functions are somewhat dependent on the underlying implementation.
Where these variations are understood they are noted below.</p>
<p>Unless otherwise noted, functions return 0 on success, or a negative
value (usually <code class="inline"><span class="w">EOF</span></code>
 which is usually -1) and set <code class="inline"><span class="w">errno</span></code>
 on error.</p>
<ul>
<li><a name="*PerlIO_stdin()*%2c-*PerlIO_stdout()*%2c-*PerlIO_stderr()*"></a><b><b>PerlIO_stdin()</b>, <b>PerlIO_stdout()</b>, <b>PerlIO_stderr()</b></b>
<p>Use these rather than <code class="inline"><span class="w">stdin</span></code>
, <code class="inline"><span class="w">stdout</span></code>
, <code class="inline"><span class="w">stderr</span></code>
. They are written
to look like "function calls" rather than variables because this makes
it easier to <i>make them</i> function calls if platform cannot export data
to loaded modules, or if (say) different "threads" might have different
values.</p>
</li>
<li><a name="*PerlIO_open(path%2c-mode)*%2c-*PerlIO_fdopen(fd%2cmode)*"></a><b><b>PerlIO_open(path, mode)</b>, <b>PerlIO_fdopen(fd,mode)</b></b>
<p>These correspond to fopen()/fdopen() and the arguments are the same.
Return <code class="inline"><span class="w">NULL</span></code>
 and set <code class="inline"><span class="w">errno</span></code>
 if there is an error.  There may be an
implementation limit on the number of open handles, which may be lower
than the limit on the number of open files - <code class="inline"><span class="w">errno</span></code>
 may not be set
when <code class="inline"><span class="w">NULL</span></code>
 is returned if this limit is exceeded.</p>
</li>
<li><a name="*PerlIO_reopen(path%2cmode%2cf)*"></a><b><b>PerlIO_reopen(path,mode,f)</b></b>
<p>While this currently exists in all three implementations perl itself
does not use it. <i>As perl does not use it, it is not well tested.</i></p>
<p>Perl prefers to <code class="inline"><span class="w">dup</span></code>
 the new low-level descriptor to the descriptor
used by the existing PerlIO. This may become the behaviour of this
function in the future.</p>
</li>
<li><a name="*PerlIO_printf(f%2cfmt%2c...)*%2c-*PerlIO_vprintf(f%2cfmt%2ca)*"></a><b><b>PerlIO_printf(f,fmt,...)</b>, <b>PerlIO_vprintf(f,fmt,a)</b></b>
<p>These are fprintf()/vfprintf() equivalents.</p>
</li>
<li><a name="*PerlIO_stdoutf(fmt%2c...)*"></a><b><b>PerlIO_stdoutf(fmt,...)</b></b>
<p>This is printf() equivalent. printf is #defined to this function,
so it is (currently) legal to use <code class="inline"><a class="l_k" href="functions/printf.html">printf(fmt,...)</a></code> in perl sources.</p>
</li>
<li><a name="*PerlIO_read(f%2cbuf%2ccount)*%2c-*PerlIO_write(f%2cbuf%2ccount)*"></a><b><b>PerlIO_read(f,buf,count)</b>, <b>PerlIO_write(f,buf,count)</b></b>
<p>These correspond functionally to fread() and fwrite() but the
arguments and return values are different.  The PerlIO_read() and
PerlIO_write() signatures have been modeled on the more sane low level
read() and write() functions instead: The "file" argument is passed
first, there is only one "count", and the return value can distinguish
between error and <code class="inline"><span class="w">EOF</span></code>
.</p>
<p>Returns a byte count if successful (which may be zero or
positive), returns negative value and sets <code class="inline"><span class="w">errno</span></code>
 on error.
Depending on implementation <code class="inline"><span class="w">errno</span></code>
 may be <code class="inline"><span class="w">EINTR</span></code>
 if operation was
interrupted by a signal.</p>
</li>
<li><a name="*PerlIO_close(f)*"></a><b><b>PerlIO_close(f)</b></b>
<p>Depending on implementation <code class="inline"><span class="w">errno</span></code>
 may be <code class="inline"><span class="w">EINTR</span></code>
 if operation was
interrupted by a signal.</p>
</li>
<li><a name="*PerlIO_puts(f%2cs)*%2c-*PerlIO_putc(f%2cc)*"></a><b><b>PerlIO_puts(f,s)</b>, <b>PerlIO_putc(f,c)</b></b>
<p>These correspond to fputs() and fputc().
Note that arguments have been revised to have "file" first.</p>
</li>
<li><a name="*PerlIO_ungetc(f%2cc)*"></a><b><b>PerlIO_ungetc(f,c)</b></b>
<p>This corresponds to ungetc().  Note that arguments have been revised
to have "file" first.  Arranges that next read operation will return
the byte <b>c</b>.  Despite the implied "character" in the name only
values in the range 0..0xFF are defined. Returns the byte <b>c</b> on
success or -1 (<code class="inline"><span class="w">EOF</span></code>
) on error.  The number of bytes that can be
"pushed back" may vary, only 1 character is certain, and then only if
it is the last character that was read from the handle.</p>
</li>
<li><a name="*PerlIO_getc(f)*"></a><b><b>PerlIO_getc(f)</b></b>
<p>This corresponds to getc().
Despite the c in the name only byte range 0..0xFF is supported.
Returns the character read or -1 (<code class="inline"><span class="w">EOF</span></code>
) on error.</p>
</li>
<li><a name="*PerlIO_eof(f)*"></a><b><b>PerlIO_eof(f)</b></b>
<p>This corresponds to feof().  Returns a true/false indication of
whether the handle is at end of file.  For terminal devices this may
or may not be "sticky" depending on the implementation.  The flag is
cleared by PerlIO_seek(), or PerlIO_rewind().</p>
</li>
<li><a name="*PerlIO_error(f)*"></a><b><b>PerlIO_error(f)</b></b>
<p>This corresponds to ferror().  Returns a true/false indication of
whether there has been an IO error on the handle.</p>
</li>
<li><a name="*PerlIO_fileno(f)*"></a><b><b>PerlIO_fileno(f)</b></b>
<p>This corresponds to fileno(), note that on some platforms, the meaning
of "fileno" may not match Unix. Returns -1 if the handle has no open
descriptor associated with it.</p>
</li>
<li><a name="*PerlIO_clearerr(f)*"></a><b><b>PerlIO_clearerr(f)</b></b>
<p>This corresponds to clearerr(), i.e., clears 'error' and (usually)
'eof' flags for the "stream". Does not return a value.</p>
</li>
<li><a name="*PerlIO_flush(f)*"></a><b><b>PerlIO_flush(f)</b></b>
<p>This corresponds to fflush().  Sends any buffered write data to the
underlying file.  If called with <code class="inline"><span class="w">NULL</span></code>
 this may flush all open
streams (or core dump with some USE_STDIO implementations).  Calling
on a handle open for read only, or on which last operation was a read
of some kind may lead to undefined behaviour on some USE_STDIO
implementations.  The USE_PERLIO (layers) implementation tries to
behave better: it flushes all open streams when passed <code class="inline"><span class="w">NULL</span></code>
, and
attempts to retain data on read streams either in the buffer or by
seeking the handle to the current logical position.</p>
</li>
<li><a name="*PerlIO_seek(f%2coffset%2cwhence)*"></a><b><b>PerlIO_seek(f,offset,whence)</b></b>
<p>This corresponds to fseek().  Sends buffered write data to the
underlying file, or discards any buffered read data, then positions
the file descriptor as specified by <b>offset</b> and <b>whence</b> (sic).
This is the correct thing to do when switching between read and write
on the same handle (see issues with PerlIO_flush() above).  Offset is
of type <code class="inline"><span class="w">Off_t</span></code>
 which is a perl Configure value which may not be same
as stdio's <code class="inline"><span class="w">off_t</span></code>
.</p>
</li>
<li><a name="*PerlIO_tell(f)*"></a><b><b>PerlIO_tell(f)</b></b>
<p>This corresponds to ftell().  Returns the current file position, or
(Off_t) -1 on error.  May just return value system "knows" without
making a system call or checking the underlying file descriptor (so
use on shared file descriptors is not safe without a
PerlIO_seek()). Return value is of type <code class="inline"><span class="w">Off_t</span></code>
 which is a perl
Configure value which may not be same as stdio's <code class="inline"><span class="w">off_t</span></code>
.</p>
</li>
<li><a name="*PerlIO_getpos(f%2cp)*%2c-*PerlIO_setpos(f%2cp)*"></a><b><b>PerlIO_getpos(f,p)</b>, <b>PerlIO_setpos(f,p)</b></b>
<p>These correspond (loosely) to fgetpos() and fsetpos(). Rather than
stdio's Fpos_t they expect a "Perl Scalar Value" to be passed. What is
stored there should be considered opaque. The layout of the data may
vary from handle to handle.  When not using stdio or if platform does
not have the stdio calls then they are implemented in terms of
PerlIO_tell() and PerlIO_seek().</p>
</li>
<li><a name="*PerlIO_rewind(f)*"></a><b><b>PerlIO_rewind(f)</b></b>
<p>This corresponds to rewind(). It is usually defined as being</p>
<pre class="verbatim"><ol><li>    PerlIO_seek(f,(Off_t)0L, SEEK_SET);</li><li>    PerlIO_clearerr(f);</li></ol></pre></li>
<li><a name="*PerlIO_tmpfile()*"></a><b><b>PerlIO_tmpfile()</b></b>
<p>This corresponds to tmpfile(), i.e., returns an anonymous PerlIO or
NULL on error.  The system will attempt to automatically delete the
file when closed.  On Unix the file is usually <code class="inline"><a class="l_k" href="functions/unlink.html">unlink</a></code>-ed just after
it is created so it does not matter how it gets closed. On other
systems the file may only be deleted if closed via PerlIO_close()
and/or the program exits via <code class="inline"><a class="l_k" href="functions/exit.html">exit</a></code>.  Depending on the implementation
there may be "race conditions" which allow other processes access to
the file, though in general it will be safer in this regard than
ad. hoc. schemes.</p>
</li>
<li><a name="*PerlIO_setlinebuf(f)*"></a><b><b>PerlIO_setlinebuf(f)</b></b>
<p>This corresponds to setlinebuf().  Does not return a value. What
constitutes a "line" is implementation dependent but usually means
that writing "\n" flushes the buffer.  What happens with things like
"this\nthat" is uncertain.  (Perl core uses it <i>only</i> when "dumping";
it has nothing to do with $| auto-flush.)</p>
</li>
</ul>
<a name="Co-existence-with-stdio"></a><h2>Co-existence with stdio</h2>
<p>There is outline support for co-existence of PerlIO with stdio.
Obviously if PerlIO is implemented in terms of stdio there is no
problem. However in other cases then mechanisms must exist to create a
FILE * which can be passed to library code which is going to use stdio
calls.</p>
<p>The first step is to add this line:</p>
<pre class="verbatim"><ol><li>   <span class="c">#define PERLIO_NOT_STDIO 0</span></li></ol></pre><p><i>before</i> including any perl header files. (This will probably become
the default at some point).  That prevents "perlio.h" from attempting
to #define stdio functions onto PerlIO functions.</p>
<p>XS code is probably better using "typemap" if it expects FILE *
arguments.  The standard typemap will be adjusted to comprehend any
changes in this area.</p>
<ul>
<li><a name="*PerlIO_importFILE(f%2cmode)*"></a><b><b>PerlIO_importFILE(f,mode)</b></b>
<p>Used to get a PerlIO * from a FILE *.</p>
<p>The mode argument should be a string as would be passed to
fopen/PerlIO_open.  If it is NULL then - for legacy support - the code
will (depending upon the platform and the implementation) either
attempt to empirically determine the mode in which <i>f</i> is open, or
use "r+" to indicate a read/write stream.</p>
<p>Once called the FILE * should <i>ONLY</i> be closed by calling
<code class="inline"><span class="i">PerlIO_close</span><span class="s">(</span><span class="s">)</span></code>
 on the returned PerlIO *.</p>
<p>The PerlIO is set to textmode. Use PerlIO_binmode if this is
not the desired mode.</p>
<p>This is <b>not</b> the reverse of PerlIO_exportFILE().</p>
</li>
<li><a name="*PerlIO_exportFILE(f%2cmode)*"></a><b><b>PerlIO_exportFILE(f,mode)</b></b>
<p>Given a PerlIO * create a 'native' FILE * suitable for passing to code
expecting to be compiled and linked with ANSI C <i>stdio.h</i>.  The mode
argument should be a string as would be passed to fopen/PerlIO_open.
If it is NULL then - for legacy support - the FILE * is opened in same
mode as the PerlIO *.</p>
<p>The fact that such a FILE * has been 'exported' is recorded, (normally
by pushing a new :stdio "layer" onto the PerlIO *), which may affect
future PerlIO operations on the original PerlIO *.  You should not
call <code class="inline"><span class="i">fclose</span><span class="s">(</span><span class="s">)</span></code>
 on the file unless you call <code class="inline"><span class="i">PerlIO_releaseFILE</span><span class="s">(</span><span class="s">)</span></code>

to disassociate it from the PerlIO *.  (Do not use PerlIO_importFILE()
for doing the disassociation.)</p>
<p>Calling this function repeatedly will create a FILE * on each call
(and will push an :stdio layer each time as well).</p>
</li>
<li><a name="*PerlIO_releaseFILE(p%2cf)*"></a><b><b>PerlIO_releaseFILE(p,f)</b></b>
<p>Calling PerlIO_releaseFILE informs PerlIO that all use of FILE * is
complete. It is removed from the list of 'exported' FILE *s, and the
associated PerlIO * should revert to its original behaviour.</p>
<p>Use this to disassociate a file from a PerlIO * that was associated
using PerlIO_exportFILE().</p>
</li>
<li><a name="*PerlIO_findFILE(f)*"></a><b><b>PerlIO_findFILE(f)</b></b>
<p>Returns a native FILE * used by a stdio layer. If there is none, it
will create one with PerlIO_exportFILE. In either case the FILE *
should be considered as belonging to PerlIO subsystem and should
only be closed by calling <code class="inline"><span class="i">PerlIO_close</span><span class="s">(</span><span class="s">)</span></code>
.</p>
</li>
</ul>
<a name="%22Fast-gets%22-Functions"></a><h2>"Fast gets" Functions</h2>
<p>In addition to standard-like API defined so far above there is an
"implementation" interface which allows perl to get at internals of
PerlIO.  The following calls correspond to the various FILE_xxx macros
determined by Configure - or their equivalent in other
implementations. This section is really of interest to only those
concerned with detailed perl-core behaviour, implementing a PerlIO
mapping or writing code which can make use of the "read ahead" that
has been done by the IO system in the same way perl does. Note that
any code that uses these interfaces must be prepared to do things the
traditional way if a handle does not support them.</p>
<ul>
<li><a name="*PerlIO_fast_gets(f)*"></a><b><b>PerlIO_fast_gets(f)</b></b>
<p>Returns true if implementation has all the interfaces required to
allow perl's <code class="inline"><span class="w">sv_gets</span></code>
 to "bypass" normal IO mechanism.  This can
vary from handle to handle.</p>
<pre class="verbatim"><ol><li>  <span class="i">PerlIO_fast_gets</span><span class="s">(</span><span class="w">f</span><span class="s">)</span> = <span class="i">PerlIO_has_cntptr</span><span class="s">(</span><span class="w">f</span><span class="s">)</span> &amp;&amp; \</li><li>                        <span class="i">PerlIO_canset_cnt</span><span class="s">(</span><span class="w">f</span><span class="s">)</span> &amp;&amp; \</li><li>                        <span class="q">&#39;Can set pointer into buffer&#39;</span></li></ol></pre></li>
<li><a name="*PerlIO_has_cntptr(f)*"></a><b><b>PerlIO_has_cntptr(f)</b></b>
<p>Implementation can return pointer to current position in the "buffer"
and a count of bytes available in the buffer.  Do not use this - use
PerlIO_fast_gets.</p>
</li>
<li><a name="*PerlIO_get_cnt(f)*"></a><b><b>PerlIO_get_cnt(f)</b></b>
<p>Return count of readable bytes in the buffer. Zero or negative return
means no more bytes available.</p>
</li>
<li><a name="*PerlIO_get_ptr(f)*"></a><b><b>PerlIO_get_ptr(f)</b></b>
<p>Return pointer to next readable byte in buffer, accessing via the
pointer (dereferencing) is only safe if PerlIO_get_cnt() has returned
a positive value.  Only positive offsets up to value returned by
PerlIO_get_cnt() are allowed.</p>
</li>
<li><a name="*PerlIO_set_ptrcnt(f%2cp%2cc)*"></a><b><b>PerlIO_set_ptrcnt(f,p,c)</b></b>
<p>Set pointer into buffer, and a count of bytes still in the
buffer. Should be used only to set pointer to within range implied by
previous calls to <code class="inline"><span class="w">PerlIO_get_ptr</span></code>
 and <code class="inline"><span class="w">PerlIO_get_cnt</span></code>
. The two
values <i>must</i> be consistent with each other (implementation may only
use one or the other or may require both).</p>
</li>
<li><a name="*PerlIO_canset_cnt(f)*"></a><b><b>PerlIO_canset_cnt(f)</b></b>
<p>Implementation can adjust its idea of number of bytes in the buffer.
Do not use this - use PerlIO_fast_gets.</p>
</li>
<li><a name="*PerlIO_set_cnt(f%2cc)*"></a><b><b>PerlIO_set_cnt(f,c)</b></b>
<p>Obscure - set count of bytes in the buffer. Deprecated.  Only usable
if PerlIO_canset_cnt() returns true.  Currently used in only doio.c to
force count less than -1 to -1.  Perhaps should be PerlIO_set_empty or
similar.  This call may actually do nothing if "count" is deduced from
pointer and a "limit".  Do not use this - use PerlIO_set_ptrcnt().</p>
</li>
<li><a name="*PerlIO_has_base(f)*"></a><b><b>PerlIO_has_base(f)</b></b>
<p>Returns true if implementation has a buffer, and can return pointer
to whole buffer and its size. Used by perl for <b>-T</b> / <b>-B</b> tests.
Other uses would be very obscure...</p>
</li>
<li><a name="*PerlIO_get_base(f)*"></a><b><b>PerlIO_get_base(f)</b></b>
<p>Return <i>start</i> of buffer. Access only positive offsets in the buffer
up to the value returned by PerlIO_get_bufsiz().</p>
</li>
<li><a name="*PerlIO_get_bufsiz(f)*"></a><b><b>PerlIO_get_bufsiz(f)</b></b>
<p>Return the <i>total number of bytes</i> in the buffer, this is neither the
number that can be read, nor the amount of memory allocated to the
buffer. Rather it is what the operating system and/or implementation
happened to <code class="inline"><a class="l_k" href="functions/read.html">read()</a></code> (or whatever) last time IO was requested.</p>
</li>
</ul>
<a name="Other-Functions"></a><h2>Other Functions</h2>
<ul>
<li><a name="PerlIO_apply_layers(f%2cmode%2clayers)"></a><b>PerlIO_apply_layers(f,mode,layers)</b>
<p>The new interface to the USE_PERLIO implementation. The layers ":crlf"
and ":raw" are only ones allowed for other implementations and those
are silently ignored. (As of perl5.8 ":raw" is deprecated.)  Use
PerlIO_binmode() below for the portable case.</p>
</li>
<li><a name="PerlIO_binmode(f%2cptype%2cimode%2clayers)"></a><b>PerlIO_binmode(f,ptype,imode,layers)</b>
<p>The hook used by perl's <code class="inline"><a class="l_k" href="functions/binmode.html">binmode</a></code> operator.
<b>ptype</b> is perl's character for the kind of IO:</p>
<ul>
<li><a name="'%3c'-read"></a><b>'&lt;' read</b>
</li>
<li><a name="'%3e'-write"></a><b>'&gt;' write</b>
</li>
<li><a name="'%2b'-read%2fwrite"></a><b>'+' read/write</b>
</li>
</ul>
<p><b>imode</b> is <code class="inline"><span class="w">O_BINARY</span></code>
 or <code class="inline"><span class="w">O_TEXT</span></code>
.</p>
<p><b>layers</b> is a string of layers to apply, only ":crlf" makes sense in
the non USE_PERLIO case. (As of perl5.8 ":raw" is deprecated in favour
of passing NULL.)</p>
<p>Portable cases are:</p>
<pre class="verbatim"><ol><li>    <span class="i">PerlIO_binmode</span><span class="s">(</span><span class="w">f</span><span class="cm">,</span><span class="w">ptype</span><span class="cm">,</span><span class="w">O_BINARY</span><span class="cm">,</span><span class="w">NULL</span><span class="s">)</span><span class="sc">;</span></li><li>and</li><li>    <span class="i">PerlIO_binmode</span><span class="s">(</span><span class="w">f</span><span class="cm">,</span><span class="w">ptype</span><span class="cm">,</span><span class="w">O_TEXT</span><span class="cm">,</span><span class="q">&quot;:crlf&quot;</span><span class="s">)</span><span class="sc">;</span></li></ol></pre><p>On Unix these calls probably have no effect whatsoever.  Elsewhere
they alter "\n" to CR,LF translation and possibly cause a special text
"end of file" indicator to be written or honoured on read. The effect
of making the call after doing any IO to the handle depends on the
implementation. (It may be ignored, affect any data which is already
buffered as well, or only apply to subsequent data.)</p>
</li>
<li><a name="PerlIO_debug(fmt%2c...)"></a><b>PerlIO_debug(fmt,...)</b>
<p>PerlIO_debug is a printf()-like function which can be used for
debugging.  No return value. Its main use is inside PerlIO where using
real printf, warn() etc. would recursively call PerlIO and be a
problem.</p>
<p>PerlIO_debug writes to the file named by $ENV{'PERLIO_DEBUG'} or defaults
to stderr if the environment variable is not defined. Typical
use might be</p>
<pre class="verbatim"><ol><li>  <span class="w">Bourne</span> <span class="w">shells</span> <span class="s">(</span><span class="w">sh</span><span class="cm">,</span> <span class="w">ksh</span><span class="cm">,</span> <span class="w">bash</span><span class="cm">,</span> <span class="w">zsh</span><span class="cm">,</span> <span class="w">ash</span><span class="cm">,</span> ...<span class="s">)</span><span class="co">:</span></li><li>   <span class="w">PERLIO_DEBUG</span>=<span class="q">/tmp/perliodebug</span>.<a class="l_k" href="functions/log.html">log</a> .<span class="q">/perl -Di somescript some args</span></li><li></li><li>  <span class="q">  Csh/</span><span class="w">Tcsh</span><span class="co">:</span></li><li>   <span class="w">setenv</span> <span class="w">PERLIO_DEBUG</span> /<span class="w">tmp</span>/<span class="w">perliodebug</span>.<a class="l_k" href="functions/log.html">log</a></li><li>   .<span class="q">/perl -Di somescript some args</span></li><li></li><li>  <span class="q">  If you have the &quot;env&quot; utility:</span></li><li>   <span class="q">   env PERLIO_DEBUG=/</span><span class="w">tmp</span>/<span class="w">perliodebug</span>.<a class="l_k" href="functions/log.html">log</a> .<span class="q">/perl -Di somescript args</span></li><li></li><li>  <span class="q">  Win32:</span></li><li>   <span class="q">   set PERLIO_DEBUG=perliodebug.log</span></li><li>   <span class="q">   perl -Di somescript some args</span></li></ol></pre><p>On a Perl built without <code class="inline">-<span class="w">DDEBUGGING</span></code>
, or when the <code class="inline">-<span class="w">Di</span></code>
 command-line switch
is not specified, or under taint, PerlIO_debug() is a no-op.</p>
</li>
</ul>




  <div id="page_index" class="hud_container">
    <div id="page_index_header" class="hud_header">
      <div id="page_index_close" class="hud_close"><a href="#" onClick="pageIndex.hide();return false;"></a></div>
      <div id="page_index_title" class="hud_title"><span class="hud_span_top">Page index</span></div>
      <div id="page_index_topright" class="hud_topright"></div>
    </div>
    <div id="page_index_content" class="hud_content">
      <ul><li><a href="#NAME">NAME</a><li><a href="#SYNOPSIS">SYNOPSIS</a><li><a href="#DESCRIPTION">DESCRIPTION</a><ul><li><a href="#Co-existence-with-stdio">Co-existence with stdio</a><li><a href="#%22Fast-gets%22-Functions">"Fast gets" Functions</a><li><a href="#Other-Functions">Other Functions</a></ul></ul>
    </div>
    <div id="page_index_footer" class="hud_footer">
      <div id="page_index_bottomleft" class="hud_bottomleft"></div>
      <div id="page_index_bottom" class="hud_bottom"><span class="hud_span_bottom"></span></div>
      <div id="page_index_resize" class="hud_resize"></div>
    </div>
  </div>


	    &nbsp;
          </div>
          <div id="content_footer">
          </div>
        </div>
        <div class="clear"></div>
      </div>
      
    <div id="footer">
      <div id="footer_content">
        <div id="footer_strapline">
          perldoc.perl.org - Official documentation for the Perl programming language
        </div>
        <div id="footer_links">
          <div id="address">
            <p class="name">Contact details</p>
            <p class="address">
	      Site maintained by <a href="mailto:jj@jonallen.info">Jon Allen (JJ)</a><br>
	    </p>
            <p class="contact">
              Documentation maintained by the <a href="http://lists.cpan.org/showlist.cgi?name=perl5-porters">Perl 5 Porters</a>
            </p>
          </div>
          <ul class="f1">
            <li>Manual
              <ul class="f2">
                <li><a href="index-overview.html">Overview</a>
                <li><a href="index-tutorials.html">Tutorials</a>
                <li><a href="index-faq.html">FAQs</a>
                <li><a href="index-history.html">Changes</a>
              </ul>
            <li>Reference
              <ul class="f2">
                <li><a href="index-language.html">Language</a>
                <li><a href="index-functions.html">Functions</a>
                <li><a href="perlop.html">Operators</a>
                <li><a href="perlvar.html">Variables</a>
              </ul>
            <li>Modules
              <ul class="f2">
                <li><a href="index-modules-A.html">Modules</a>
                <li><a href="index-pragmas.html">Pragmas</a>
                <li><a href="index-utilities.html">Utilities</a>
              </ul>
            <li>Misc
              <ul class="f2">
                <li><a href="index-licence.html">License</a>
                <li><a href="index-internals.html">Internals</a>
                <li><a href="index-platforms.html">Platforms</a>
              </ul>          </ul>
          <div class="clear"></div>
        </div>
      </div>
      <div id="footer_end">
      </div>
    </div>
      
    </div>
      <script language="JavaScript" type="text/javascript" src="static/exploreperl.js"></script>
      <script language="JavaScript" src="static/combined-20100403.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
  perldoc.setPath(0);
  perldoc.pageName    = 'perlapio';
  perldoc.pageAddress = 'perlapio.html';
  perldoc.contentPage = 1;
  explorePerl.render();
  explorePerl.addEvents('explore_anchor');
</script>
    
  </body>
</html>