std::fputs(3)
π NAME π
okay bestie, welcome to std::fputs(3) from the C++ Standard Libary manual β yes, that's the manual name, and yes, the typo is part of the lore π. The name section is literally std::fputs β std::fputs, which is giving "I said what I said" energy π
.
π¦ Synopsis π¦
Defined in header <cstdio>:
int fputs( const char* str, std::FILE* stream );
It writes every character from the null-terminated string str to the output stream stream, as if by repeatedly executing std::fputc. The terminating null character from str is not written, bestie β that little \0 stays home π«Ά.
πΈ Parameters πΈ
strβ null-terminated character string to be writtenstreamβ output stream
π« Return value π«
On success, returns a non-negative value β¨.
On failure, returns EOF and sets the error indicator (see std::ferror) on stream π.
π§ Notes π§
The related function std::puts appends a newline character to the output, while std::fputs writes the string unmodified. no cap, that newline is not invited to this party π.
Different implementations return different non-negative numbers: some return the last character written, some return the number of characters written (or INT_MAX if the string was longer than that), some simply return a non-negative constant such as zero. so likeβ¦ don't build your whole personality on the exact return number, okay? π
π Example π
// Run this code
#include <cstdio>
int main(void)
{
int rc = std::fputs("Hello World", stdout);
if (rc == EOF)
std::perror("fputs()"); // POSIX requires that errno is set
}
π» Output π»
Hello World
π See also π
printffprintfβ prints formatted output tostdout, a file stream or a buffer (function)sprintfβ (function)snprintfβ(C++11)(function)putsβ writes a character string tostdout(function)fputwsβ writes a wide string to a file stream (function)fgetsβ gets a character string from a file stream (function)- C documentation for
fputs
source/version/date vibe check, bestie: http://cppreference.com Β· 2024.06.10 Β· std::fputs(3) ππ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms