คนใช้ linux (หรือ cygwin ก็ด่ะ) น่าจะรู้จักคำสั่ง man ที่เอาไว้ใช้ดู manual ของคำสั่งต่างๆ ใน linux
ท่านผู้อ่าน รู้หรือไม่ว่า? เราสามารถใช้คำสั่ง
$ man qsort
เพื่อดูรายละเอียดของฟังก์ชัน qsort ได้ผลลัพธ์ตามนี้ (ทีนี้จะได้รู้และว่าต้อง include file ไหนและฟังก์ชันรับอาร์กิวเมนท์อะไรบ้าง)
QSORT(3) Linux Programmer`s Manual QSORT(3) NAME qsort - sorts an array SYNOPSIS #include void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)); DESCRIPTION The qsort() function sorts an array with nmemb elements of size size. The base argument points to the start of the array.
แต่! ก่อนที่จะทำแบบนี้ได้ต้องติดตั้งแพคเกจ manpages-dev ก่อนครับ สำหรับผู้ใช้ ubuntu/debian (ใช้ Synaptic ติดตั้ง หรือ sudo apt-get install manpages-dev ก็ได้ครับ) สำหรับคนใช้ดิสโทรอื่นต้องลองค้น google ดูครับ
ถ้าลอง man printf ดูจะเจอ manual ของคำสั่ง printf ของ linux แทนที่จะเป็น reference ของฟังก์ชัน printf ของภาษา C แทน
วิธีเปิด manual ของ printf (ฟังก์ชันภาษา C) ให้เรียกคำสั่ง
$ man 3 printf
แทน ซึ่งหมายความว่า เปิดดูคำสั่ง printf ใน section ที่ 3 ของ manual ครับ (manual มีทั้งหมด 7-8 section… เขาแบ่ง section ตามหัวข้อครับ ดูรายละเอียดเพิ่มเติมที่นี่)