printf.3 (77794) | printf.3 (78180) |
---|---|
1.\" Copyright (c) 1990, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" This code is derived from software contributed to Berkeley by 5.\" Chris Torek and the American National Standards Committee X3, 6.\" on Information Processing Systems. 7.\" 8.\" Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34.\" SUCH DAMAGE. 35.\" 36.\" @(#)printf.3 8.1 (Berkeley) 6/4/93 | 1.\" Copyright (c) 1990, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" This code is derived from software contributed to Berkeley by 5.\" Chris Torek and the American National Standards Committee X3, 6.\" on Information Processing Systems. 7.\" 8.\" Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34.\" SUCH DAMAGE. 35.\" 36.\" @(#)printf.3 8.1 (Berkeley) 6/4/93 |
37.\" $FreeBSD: head/lib/libc/stdio/printf.3 77794 2001-06-05 23:39:45Z imp $ | 37.\" $FreeBSD: head/lib/libc/stdio/printf.3 78180 2001-06-13 19:05:12Z schweikh $ |
38.\" 39.Dd June 4, 1993 40.Dt PRINTF 3 41.Os 42.Sh NAME 43.Nm printf , 44.Nm fprintf , 45.Nm sprintf , --- 88 unchanged lines hidden (view full) --- 134and 135.Fn vasprintf 136set 137.Fa *ret 138to be a pointer to a buffer sufficiently large to hold the formatted string. 139This pointer should be passed to 140.Xr free 3 141to release the allocated storage when it is no longer needed. | 38.\" 39.Dd June 4, 1993 40.Dt PRINTF 3 41.Os 42.Sh NAME 43.Nm printf , 44.Nm fprintf , 45.Nm sprintf , --- 88 unchanged lines hidden (view full) --- 134and 135.Fn vasprintf 136set 137.Fa *ret 138to be a pointer to a buffer sufficiently large to hold the formatted string. 139This pointer should be passed to 140.Xr free 3 141to release the allocated storage when it is no longer needed. |
142If sufficient space cannot be allocated, | 142If sufficient space cannot be allocated, |
143.Fn asprintf 144and 145.Fn vasprintf 146will return -1 and set 147.Fa ret 148to be a NULL pointer. 149.Pp 150.Fn Snprintf --- 48 unchanged lines hidden (view full) --- 199.It 200Zero or more of the following flags: 201.Bl -hyphen 202.It 203A 204.Cm # 205character 206specifying that the value should be converted to an ``alternate form''. | 143.Fn asprintf 144and 145.Fn vasprintf 146will return -1 and set 147.Fa ret 148to be a NULL pointer. 149.Pp 150.Fn Snprintf --- 48 unchanged lines hidden (view full) --- 199.It 200Zero or more of the following flags: 201.Bl -hyphen 202.It 203A 204.Cm # 205character 206specifying that the value should be converted to an ``alternate form''. |
207For | 207For |
208.Cm c , 209.Cm d , 210.Cm i , 211.Cm n , 212.Cm p , 213.Cm s , 214and 215.Cm u , 216conversions, this option has no effect. | 208.Cm c , 209.Cm d , 210.Cm i , 211.Cm n , 212.Cm p , 213.Cm s , 214and 215.Cm u , 216conversions, this option has no effect. |
217For | 217For |
218.Cm o 219conversions, the precision of the number is increased to force the first 220character of the output string to a zero (except if a zero value is printed 221with an explicit precision of zero). 222For 223.Cm x 224and 225.Cm X --- 140 unchanged lines hidden (view full) --- 366or 367.Em unsigned long int 368argument, or that a following 369.Cm n 370conversion corresponds to a pointer to a 371.Em long int 372argument. 373.It | 218.Cm o 219conversions, the precision of the number is increased to force the first 220character of the output string to a zero (except if a zero value is printed 221with an explicit precision of zero). 222For 223.Cm x 224and 225.Cm X --- 140 unchanged lines hidden (view full) --- 366or 367.Em unsigned long int 368argument, or that a following 369.Cm n 370conversion corresponds to a pointer to a 371.Em long int 372argument. 373.It |
374The optional characters 375.Cm ll 376(ell ell) specifying that a following 377.Cm d , 378.Cm i , 379.Cm o , 380.Cm u , 381.Cm x , 382or 383.Cm X 384conversion applies to a pointer to a 385.Em long long int 386or 387.Em unsigned long long int 388argument, or that a following 389.Cm n 390conversion corresponds to a pointer to a 391.Em long long int 392argument. 393.It |
|
374The optional character 375.Cm q , 376specifying that a following 377.Cm d , 378.Cm i , 379.Cm o , 380.Cm u , 381.Cm x , --- 236 unchanged lines hidden (view full) --- 618.Fn printf , 619.Fn sprintf , 620.Fn vprintf , 621.Fn vfprintf , 622and 623.Fn vsprintf 624functions 625conform to | 394The optional character 395.Cm q , 396specifying that a following 397.Cm d , 398.Cm i , 399.Cm o , 400.Cm u , 401.Cm x , --- 236 unchanged lines hidden (view full) --- 638.Fn printf , 639.Fn sprintf , 640.Fn vprintf , 641.Fn vfprintf , 642and 643.Fn vsprintf 644functions 645conform to |
626.St -ansiC | 646.St -ansiC |
627and 628.St -isoC-99 . 629The 630.Fn snprintf 631and 632.Fn vsnprintf 633functions conform to 634.St -isoC-99 . --- 73 unchanged lines hidden --- | 647and 648.St -isoC-99 . 649The 650.Fn snprintf 651and 652.Fn vsnprintf 653functions conform to 654.St -isoC-99 . --- 73 unchanged lines hidden --- |