Name

sprintf function — Writes formatted data to a string

Synopsis

int sprintf(char* s, const char* format, ...)

The sprintf function is like fprintf, but instead of writing to an open file, it “writes” by copying characters to the string s. See fprintf for a description of the format parameter.

You must ensure that s is large enough for the formatted string. For some formats, this is impossible, which makes sprintf unsafe to use.

Get C++ In a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.