LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   c/c++ linux resources (https://www.linuxquestions.org/questions/programming-9/c-c-linux-resources-359715/)

exodist 09-02-2005 11:52 PM

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.

runlevel0 09-03-2005 08:44 AM

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 ;)

Hko 09-03-2005 02:05 PM

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/

exodist 09-03-2005 02:27 PM

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.

exodist 09-03-2005 03:42 PM

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.

exodist 09-03-2005 03:44 PM

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.


All times are GMT -5. The time now is 12:29 AM.