Wait, you can use man
on C++ functions?
Comment on What is this format specifier?
AlmightySnoo@lemmy.world 1 year ago
If you want multi-line code, you need to put it like this:
For these kinds of questions, your best buddy is the documentation. In particular, a man ‘printf(3)’
yields:
Format of the format string
The format string is a character string, beginning and ending in its initial shift state, if any. The format string is composed of zero or more directives: ordinary characters (not %), which are copied unchanged to the output stream; and conversion specifications, each of which results in fetching zero or more subsequent arguments. Each conversion specification is introduced by the character %, and ends with a conversion specifier. In between there may be (in this order) zero or more flags, an optional minimum field width, an optional precision and an optional length modifier.
The overall syntax of a conversion specification is:
%[$][flags][width][.precision][length modifier]conversion
starman@programming.dev 1 year ago
Eufalconimorph@discuss.tchncs.de 1 year ago
On libc functions yes. Maybe on some from other libs, if they provide man pages.
starman@programming.dev 1 year ago
That’s nice.
ono@lemmy.ca 1 year ago
You can if you have those man pages installed.
AlmightySnoo@lemmy.world 1 year ago
Yup! Try also
man malloc
😁starman@programming.dev 1 year ago
Nice :)
JBloodthorn@kbin.social 1 year ago
Back in my day, MS-DOS let you use
HELP
on QBASIC commands.
PoolloverNathan@programming.dev 1 year ago
Wouldn’t
man 3 printf
do the same thing without the quotes?AlmightySnoo@lemmy.world 1 year ago
Yup that definitely does the same thing.
If anyone else is wondering why the
3
is there, it’s because usually you won’t find just oneprintf
. You have theprintf
user command, theprintf
function from the standard C library, and POSIX manual entries for both theprintf
user command and C function. The id number is then an identifier for the corresponding section of theprintf
entry, and you can list all of them by doing aman -f printf
.JackbyDev@programming.dev 1 year ago
Awesome, I think I’m gonna consider aliasing
man
toman -f
lol. Can you think of any compelling reason not to?Actually, nevermind, I misunderstood you.
-f
just lists the pages, it doesn’t print all of their content.ono@lemmy.ca 1 year ago
Nit: 3 is the manual section in which to look for the named entry (aka page), not a section of the entry.
AlmightySnoo@lemmy.world 1 year ago
Wrote it in an awkward way but yeah I meant to say the section where you can find the corresponding entry 😬