Where Are the Man Pages for C++

In Linux, how do I get man pages for C functions rather than for bash commands?

man 2 bind

You need a result from a different section of the manual! Man searches various sections for the information you want. As devnull lists below, the number indicates which section to search.

Incidentally, bind is a system call, not a C library function. System calls (kernel calls) are in section 2 of the manual, library functions are in section 3.

man man will tell you how to use the man command!

Where are the man pages for C++?

If you use the "normal" libstdc++ shipped with g++, its documentation is available online here.

Most Linux distributions make it also available offline as a particular package; for Debian-derived distros, for example, it's libstdc++-6-<version>-doc (e.g. on my Ubuntu machine I have libstdc++-6-4.4-doc installed). In general the documentation will be put somewhere like /usr/share/doc/libstdc++-6-4.4-doc.

This about implementation-specific documentation; for compiler-agnostic docs, instead, many sites on the Internet provide reference documentation for the standard library.

One of the most referenced is nowadays cppreference.com, that is actively maintained, tends to be very faithful to the standard and shows well the differences between the various standard versions; it can be a bit intimidating to newbies, though.

cplusplus.com historically was one of the most used (especially as it is very "liked" by search engines), but was known to contain several errors or incorrect simplifications; I don't know if it got any better in these last years.

Also, the C++ library section on msdn.microsoft.com has got much better in the recent years in separating what are the Microsoft-specific details from what the standard dictates.

Finally, if you want precision up to the paranoia, the ultimate normative document is the C++ standard, that is sold from ISO, ANSI and BSI (for a quite high price); there are however several drafts available for free, which are more than good enough for "casual use".

Where is the man page for the format specifiers in the C function printf?

The unix manual is divided into sections. The following are the first three:

  1. Command-line utilities (e.g. bash)
  2. System calls (e.g. open)
  3. C functions (e.g. fopen)

man printf returns the first match found, but you don't want information on the printf command-line utility; you want information on the printf C function. As such, you should be using

man 3 printf

Man pages for gcc Library functions

mknod() the C function lives in section 2 of the man pages. You can view it using:

man -s2 mknod

In general things like this are likely to live in either section 2 (system calls) or section 3 (library calls)

Where is the 'man' Program for Windows (Program to open UNIX man pages)?

If you are looking to open linux style man pages in Windows, then get Groff for Windows to view the man pages on your command line as follows:

groff -Tascii -mm your_file | more

How to find man pages for C structs (struct sockaddr_in)?

You can find that specific structure by typing man 7 ip and then searching manually for it or pressing / and typing sockaddr_in.

If you don't know what section to look in you can try using a quick search with man -k sockaddr_in. If that doesn't give you the result you are looking for try brute-forcing it with man -K sockaddr_in, this might be very slow because it will scan all the man files on your system.

@Jean-FrançoisFabre his comment about using a search engine is probably the fastest way to find the information you want though.

man pages for c variable types

Read the C11 standard. On wikipedia, you will find referencess to all standards, including the older ones. Do not worry (too much) about them being draft; that is mustly due to ortographic corrections, etc. The final versions will cost money, so most here (and elsewhere) use the drafts.

Linux man pages for C functions are mostly a courtesy and cover POSIX aspects. You should not rely they exist or complain they do not.

If you have problems reading the standard, just get a good book.

How to install man pages for C++11

Okay, I found this: https://github.com/aitjcize/cppman

Since cppman is no longer supported under Ubuntu/apt it has to be installed via

pip3 install cppman

and if you want to have the man pages offline you may cache them by

cppman -c

make sure to have your preferred source selected. cplusplus.com should be default.



Related Topics



Leave a reply



Submit