LinuxQuestions.org
Review your favorite Linux distribution.
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 09-03-2005, 12:52 AM   #1
exodist
Senior Member
 
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Gentoo
Posts: 1,372

Rep: Reputation: 47
c/c++ linux resources


I am a programming student and I just earned my Assoc of Arts in programming. I am also a long time linux user. I am familiar with several languages, java, C#, C++, perl, bash shell scripting.

Here is my problem, When it comes to C++ I am very educated/familiar with the langiuage syntax and standard library. However I have no experience on any platform of api-platform specifics. I can easily write complex c programs that do a lot, but they only use standard language syntax and standard library.

Recently my programs have gotten larger and more complex, I have been told of functions that are specific to the operating system. Recently someone started talkign to me about "malloc()" I have no clue what it is.

Instead of simply asking what the function is and does (I have an idea from what they told me) I am instead curious as to where I can go to learn about this and the linux api in general.

I want to use the linux api, the problem is I cannot find a solution to a specific situation in a reference because I do not know it exists in the first place.

My first thaught was search for linux programming books on amazon, and find web-tutorials.

But the problem now is most of the tutorials and books use C not C++.. Why is this a problem? Because my code is all c++, its all I have learned/was taught. I follow the tutorials and understand what I am writing, but I am completely oblivious as to how I might mix what I have learned in C into my C++ code, and I am unable to expand the C code because once again I only know c++

I used to thing C++ was C with extra stuff such as objects, but apparently there are syntax differences as well because I am just lost.


So... where do I go, what do I read, what do I experiment with? How can I learn the differnces in c and C++, and how can I learn how to apply what I learn in one to the other?

Where can I learn the linux API?

I am very frustrated, please help me find resources. I am willing to put the effort into reading, experimenting, and doing things for myself, I do not expect knowledge or experience to be downloeded into my mind.
 
Old 09-03-2005, 09:44 AM   #2
runlevel0
Member
 
Registered: Mar 2005
Location: Hilversum/Holland
Distribution: Debian GNU/Linux 5.0 (“Lenny”)
Posts: 290

Rep: Reputation: 31
With "Linux API" I suppose you are talking about the kernel.

The answer to your questions is easier as you ever thought:

All the docs you need are inside the system itself.

Get familiar with the commands man and [b]info[b]
Specially section 3 an P of the man pages.

Say you need info about the syntax of fprintf(), here's the way to ask for it:

Code:
man 3 fprintf
To learn about stdio.h

Code:
man P stdio.h
Info works similar but it works in an own browsable format:
Code:
info gcc
KDE's Konqueror browser uses a more convenient way to browse through the man and info docs just writing a line like the following into the URL window:
Code:
man:fprintf
info:gcc
GNOME also offers a convenient richtext acces to all this documentation through Gnome's desktop help system (it's on the panel).



There is much more!
In /usr/share/doc/linux-VERSION
Is a Poscscript version of the whole kernel documentiotion and you can find the plain text version of *anything* in the kernel inside /usr/src/linux/Documentation.

More elaborate documentation can be fond at the TLDP (The Linux Documentation Proyect), where you can find just about anything related to your question: API, syscals, libraries for C and C++, lot's and lot's of stuff. There is the kernel hacker guide, the module programming guide, guides about the libc6, gcc and gdb (the debugger)...

aps, the URL http://tldp.org

Normally every piece of software related to the basic toolchain (compiler, assembler, debugger, libc6, kernel and related stuff) has info in their own /usr/share/doc directory.

Furthermore: If you use KDE and the fantastic KDevelop environment you will get all the documentation indexed and some extra dox more available from the "documentation" tab just on the IDE itself...

It's not documentation what we miss in Free Software and specially not the one related to system API's

Hope it helped, and happy hacking
 
Old 09-03-2005, 03:05 PM   #3
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 110Reputation: 110
About malloc():
If you're familiar with C++, you'll know about the new operator. Malloc() is used in C to get a block of memory dynamically, just like new in C++.
Some differences:
  • malloc() is a function, a syscall, while new is an operator.
  • With malloc() you must specify how much bytes you need, while new finds out automatically how much bytes is needed for the given object.
  • The new operator call the constructor of the object to create. With malloc(), you just ask for a certain number of bytes and you either get them all, or an error. Malloc just does that, nothing more.
  • Malloc() the more "raw" version. I suppose new actually uses malloc() behind the scene.

One resource about the Linux/UNIX API: The book "Advanced Linux Programming" is downloadable for free (1 PDF per chapter). See:

http://www.advancedlinuxprogramming.com/
 
Old 09-03-2005, 03:27 PM   #4
exodist
Senior Member
 
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Gentoo
Posts: 1,372

Original Poster
Rep: Reputation: 47
First reply:

I knew most of what you told me, I am not asking how to find out what a specific function does, my problem is I need to know the function exists before I can look it up, I need a list of functions, a list of whats what very brief, for details on what they do I have no problem.

Second reply:

Thanx, that very informative.
 
Old 09-03-2005, 04:42 PM   #5
exodist
Senior Member
 
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Gentoo
Posts: 1,372

Original Poster
Rep: Reputation: 47
http://people.cs.uchicago.edu/~ianco...stuff/ccc.html

This sie helped me with the c VS. c++ stuff, I am pretty clear on that now, really what I need is a list of functiosn, libraries to call, and a breif description of what they do, then I can look up in depth stuff on specific functions in man pages later.
 
Old 09-03-2005, 04:44 PM   #6
exodist
Senior Member
 
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Gentoo
Posts: 1,372

Original Poster
Rep: Reputation: 47
http://www.google.com/url?sa=t&ct=re...WeLrT2YOCt5OYL this is nice, this is probably what I was looking for, just needed to refine my google search, if anyone can give me a site that expands on it, or if someone can say how complete this list is that would be great, thanx.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Your favorite linux resources dezza General 10 05-10-2005 05:55 PM
Linux resources [LAG] Prude Linux - Newbie 1 03-17-2005 06:54 PM
Linux Resources Crimson Azure Linux - Newbie 1 09-26-2003 07:01 AM
linux resources? Suspect Linux - Newbie 2 08-30-2002 06:17 AM
Linux Resources snowboarder401 Linux - Newbie 1 08-06-2001 05:38 PM

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

All times are GMT -5. The time now is 11:49 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration