LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-19-2017, 11:21 AM   #1
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,307
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
Authoritative descriptions of module functions in C


I have a bit of a newb question about C modules here: how do I find the authoritative descriptions of common modules and the functions they contain?

For example printf() and sprintf() are in stdio.c. Where can I find the last word in what parameters they take and how to use them? Yes, I know those two functions. I'm wondering where I can look them up how to use them and other common modules in general.
 
Old 10-19-2017, 11:49 AM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,223

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
You open the headers in /usr/include and you look at them.
 
Old 10-19-2017, 12:05 PM   #3
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,307

Original Poster
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
Been there, done that. I was hoping for more annotation, maybe a paragraph or two on each function.

Code:
$ grep -A 2 '[[:space:]]printf(' /usr/include/stdio.h 
int      printf(const char *, ...);
int      putc(int, FILE *);
int      putchar(int);
Is there any kind of manual page that can be generated or a reference manual somewhere?

Last edited by Turbocapitalist; 10-19-2017 at 12:10 PM.
 
Old 10-19-2017, 12:17 PM   #4
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,223

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Yep.

Code:
man 3 stdio
man 3 printf
 
Old 10-19-2017, 12:23 PM   #5
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,307

Original Poster
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
Ok. I picked poor examples, and was missing a package. I've added the package build-essentials and now see even a manual page for things like ftell.

So is it the case in general that C functions each get their own manual page in section 3?
 
Old 10-19-2017, 12:32 PM   #6
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
As Dugan has indicated, manual section 3 is the place (man man):

Code:
3      C Library Functions
If you are an info user, info printf will, for example, usually return all available man pages, sometimes alternate documentation.
 
Old 10-19-2017, 12:36 PM   #7
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,307

Original Poster
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
Ok. Thanks to both of you.
 
Old 10-19-2017, 02:01 PM   #8
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Also there is 'info libc' (or 'tkinfo libc' for GUI)
 
Old 10-23-2017, 04:26 PM   #9
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora and others
Posts: 757

Rep: Reputation: 145Reputation: 145
Some systems don't have man pages unless you explicitly install them.
Rather than figuring out what to install, you can always use your browser.
There are a number of sites that have man pages.
Here are two:
 
Old 10-25-2017, 07:49 AM   #10
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940
It's also worth noting that "C" has no way to know that the information in the header-file is correct. It is your responsibility to ensure that header-files needed by external libraries are, in fact, correct, and that compiler-options and linker-options are such to correctly call the subroutines in the library. Otherwise, you will witness a small thermonuclear explosion.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
howto use one module's dev/functions in another module. urup Linux - Kernel 5 06-27-2008 06:39 AM
How to use functions exported by module in user application kandhala Linux - Kernel 1 12-15-2007 03:40 AM
use module functions in own C program? captaint Programming 4 06-30-2007 04:44 AM
warning undefined functions.....doing kernel module programing swift_a2002 Programming 10 05-24-2007 11:50 AM
linking freeradius functions to an external auth module kky Programming 0 09-26-2006 09:16 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration