printf


Description:

[ CCode ( error_pos = 2.8 , sentinel = "" ) ]
[ Version ( since = "2.40" ) ]
public bool printf (out size_t bytes_written, Cancellable? cancellable, string format, ...) throws Error

This is a utility function around write_all.

It uses vprintf to turn format and ... into a string that is then written to this.

See the documentation of write_all about the behavior of the actual write operation.

Note that partial writes cannot be properly checked with this function due to the variable length of the written string, if you need precise control over partial write failures, you need to create you own printf-like wrapper around write or write_all.

Parameters:

this

a OutputStream.

bytes_written

location to store the number of bytes that was written to the stream

cancellable

optional Cancellable object, null to ignore.

format

the format string. See the printf documentation

...

the parameters to insert into the format string

error

location to store the error occurring, or null to ignore

Returns:

true on success, false if there was an error