Central Clickable MSDN like Linux System/C/C++ Standard Library Documentation - c++

If you are windows programmer and you want to program something new where you
are going to use some new API with which you are not that familiar then you can type MSDN on your web browser and you get immediately what you need. Nicely grouped API functions where you can see what to include and what to link.
I am looking for something similar in the Linux world. I want to sleep my function for some milliseconds and I type "man sleep" then I get the explanation of shell command "sleep". But I don't want that. I am programming and I just want see the programmatical usage of that function.
So the question is: Is there a central, clickable and browsable documentation of C, C++ standard libraries AND linux system calls which are not part of the C/C++ standard but quite often used in linux programming ?
Thanks in advance,
G.

Man is broken down into sections If you type "man man" you can see them.
1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conven‐
tions), e.g. man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]
So since you wnat the library call version of sleep() you would write "man 3 sleep". Also "info" is another way to access the same information.
You can also do a search with "man -k sleep", which will list everything matching sleep.
There are hyperlinked man pages scattered around the internet if you want to bookmark them.
For C++ APIs there are some good sites that many people have bookmarked and open a good portion of the time.
The important thing to remember is that unlike Windows, no one really owns or controls Linux. You can build any kind of distribution you want with many different kernel options. It makes things less tidy in some ways but far more flexible in others.

Well in your case you could have typed "man 3 sleep"...
Konqueror (the KDE web/file browser) lets you type "#XXX" in the bar to look up the man page for XXX, and "##XXX" to look up the info page for XXX. Unlike man, it gives you the choice between which man page you want to choose if there is more than one. They are interlinked together, so looking up "sleep", you will see in the "SEE ALSO" section, signal, and you can click it to go to its man page.
I don't know of anything like this for C++, but there are several good websites with documentation:
http://www.cplusplus.com/reference/
http://www.sgi.com/tech/stl/
(just to name a few that I use regularly)

By default, man pages look under man 1, which is classified as "General Commands." You want man 3, which is "Subroutines."
For a list of all the man pages, and their topics, I use http://www.linuxmanpages.com/ a lot, which is just a copy of all the man pages online.

man 3 sleep
You can also browse them online, http://www.kernel.org/doc/man-pages/
Man pages are nice for reference, but they do not substitute a book on unix programming.
However, many libraries maintain browsable and verbose documentation. Like Qt, Boost, and many others.
Some tools are stand-alone projects, like Valgrind, and it's up to you to choose tools. The freedom to choose tools has a cost: there is no central point of reference.
But Google is the ultimate place to search for the appropriate tools, manuals and references. Actually, it's very good in finding and indexing unix programming manuals. Ctrl+K in Firefox, unix sleep function, and here you go.

Related

Pseudographical environment in windows Command Prompt

actually i'm thinking of creating a cool interface for my programming assignment , so i go around searching on how to do it so that such an effect can be create , below is the image .
The Question
1.)What is needed in order to create a program that run pseudographic(semigraphic or whatever they called it) that has menu like BIOS wizard did??I always see some program run in console but it could have graphical-like looking , for example blue environment , and user can use keyboard to choose a list of setting in a menu.
Thanks for spending time reading my question.
It's called Text-based user interface. There're several libraries for doing this. I think this is what you're looking for. :)
Cross platform, Interactive text-based interface with command completion
http://www.gnu.org/s/ncurses/
Ncurses(or maybe pdcurses) is probably what you need.
In the days of 16-bit Windows console windows used to support ANSI escape sequences (via the ansi.sys driver), but they no longer do.
For the apparent line graphics you need to use a platform specific solution anyway, so I recommend just writing an abstraction (functions, class) over the Windows APIs console functions.
The line graphics is done by using characters from the original IBM PC character set, codepage 437. At first you can just hardcode the various patterns. In order to make it seem more like line drawing to the code, or from the code's perspective, so to speak, you'll have to abstract things again. As I remember there is some partial but not complete system in the original codepage 437 character codes. But for Windows console you will need to use the Unicode character codes, which probably do not preserve the original system, so perhaps just define a map where these graphics characters are placed more systematically.
Possibly that already exists.
If you don't care about portability, the Windows API for this can be found here. It will supply all the functions you need, without the need to pack additional libraries with your application.
You can also look in to graphics.h, a non-standard Borland extension that a lot of older graphical games used to use. It goes far beyond the normal limits of the console, but is only supported by 16 bit systems, of which Microsoft has all but removed support for from Windows. You'd also need an ancient Borland compiler, or an emulation, though you probably want the original look and feel.

c++: program settings - boost.PropertyTree or boost.program_options?

I was looking for a solution to store program settings or options or configuration in C++. These could be settings that are exposed in a GUI and need to be saved between runs of my code.
In my search I came across boost.PropertyTree which seemed to be a good choice. I know boost is well respected code so I'm comfortable using it and so I started developing using this. Then I come across boost.program_options which seems to allow you to do the same thing but also looks more specialized for the specific use-case of program settings.
Now I'm wondering which is the most appropriate for the job? (or is there a 3rd option that is better than both)
EDIT:
fyi this is for a plugin so it will not use command line options (as in, it's not even possible).
UPDATE
I ended up sticking with boost.PropertyTree. I needed to be able to save changed options back to the INI, and I didn't see a way of doing that with boost.program_options.
Use boost::program_options. It's exactly what it's for. In one library you get command line options, environment variables options and an INI-like configuration file parser. And they're all integrated together in the Right way, so when then the user specifies the same option in more than one of these sources the library knows the Right priority order to consider.
boost::property_tree on the other hand is a more generalized library. The library parses the text stream into a uniform data model. But You need to do the real parsing -- that of making sense of the blob of data for your needs. The library doesn't know when to expect a parameter when it sees a particular option string, or to disallow specific values or types of values for a particular option.
After some digging around I think boost.PropertyTree is still the best solution because it gives me the capability to save the options after changing them from within the program which is a requirement.
There is a non-Boost possibility too. Config4Cpp is a robust, simple-to-use and comprehensively documented configuration-file parser library that I wrote. It is available at www.config4star.org.
I suggest you read Chapter 3 (Preferences for a GUI Application) of the Practical Usage Guide manual to read an overview of how Config4Cpp can do what you want. Then open the Getting Started Guide manual, and skim-read Chapters 2 and 3, and Section 7.4 (you might prefer to read the PDF version of that manual). Doing that should give you sufficient details to help you decide if Config4Cpp suits your needs better or worse than Boost.
By the way, the indicated chapters and sections of documentation are short, so they shouldn't take long to read.

GTK+ with any programs

I recently knew a latex-editor "gummi", see http://gummi.midnightcoding.org/
, which is written by GTK+ graphical interface toolkit. There are two panels, one in the left which is an editor (using the library gtksourceview) and on in the right which is a viewer (using the library poppler). I am curious that if we can do similary things for every program.
For example, replace the editor with "terminal"、"emacs"、"vim"、"terminator (a multi-windows terminal)"...etc. And replace the viewer with other viewers, which in my mind is Adobe Reader.
With discussion with the author, he mentioned:
The viewer component is also replacable, but doing it with Adobe Reader would not be easy or perhaps even impossible. The reason for this being that Adobe Reader is a complete program instead of a library, and also closed-source
So I have some questions:
a) We can only make "library" embedded as a panel, but we can't do this for a (any) program?
b) Could we replace the editor with emacs? with terminal?
c) Could we replace the viewer with Adobe Reader? If not, why? Because it's a program or it's closed-source?
I know the questions in this thread are not very precise, sorry.
a) You can do it for any program if it has a sufficient API for doing so, but that is rather rare. Libraries them selfes provide functionality beyond the means of the toolkit (here: gtk+). So in the end you would have to replace a class for another (within the source code) which uses another library (or provides cross process functionality).
b) terminal: yes (see anjuta), for emacs, probably yes, but from my point of view with limited knowledge about emacs I'd say it is a lot more work to achieve this
c) It has neither a sufficient cross process API nor do we have the source code to directly use its classes. You could use evince (or similar opensource pdf viewers) instead.

How do you parse the XDG/gnome/kde menu/desktop item structure in c++?

I would like to parse the menu structure for Gnome Panels (the standard Gnome Desktop application launcher) and it's KDE equivalent using c/c++ function calls. That is, I'd like a list of what the base menu categories and submenu are installed in a given machine. I would like to do with using fairly simple c/c++ function calls (with NO shelling out please).
I understand that these menus are in the standard xdg format.
I understand that this menu structure is stored in xml files such as:
/home/user/.config/menus/applications.menu
I've looked here: http://www.freedesktop.org/wiki/Specifications/menu-spec?action=show&redirect=Standards%2Fmenu-spec but all they offer is the standard and some shell files to insert item entries (I don't want shell scripts, I don't want installation, I definitely don't want to create a c-library from the XDG specification. I want to find the existing menu structure). I've looked here: http://library.gnome.org/admin/system-admin-guide/stable/menustructure-13.html.en for more notes on these structures. None of this gives me a good idea of how determine the menu structures using a c/c++ program.
The actual gnome menu structures seem to be a horrifically hairy things - they don't seem to show the menu structure but to give an XML-coded description of all the changes that the menus have gone through since installation. I assume gnome panels parses these file so there's a function buried somewhere to do this but I've yet to find where that function is after scanning library.gnome.org for a couple of days. I've scanned the Nautilus source code as well but Panels seem to exist elsewhere or are burried well.
Thanks in advance
After much painful research... it seems the most stable approach is to take the gnome menu parsing code, rip it of the tar ball and use it locally.
The version I used is here:
http://download.gnome.org/sources/gnome-menus/2.28/gnome-menus-2.28.0.1.tar.gz
This code loudly proclaims that it shouldn't treated as any kind of API so one is forced to, as I said rip it of the gnome tree and keep a local copy for one's own application (gather than dynamically linking to a library).
The KDE version of the menu-parsing code seems like it could be used more transportably but actually depends heavily on KDE's virtual file system. As far as I can tell, the code gnome works stand-alone. The test-file can serve as a template for doing your own parsing.

How to search wikipedia and get input or info in C++?

I want my program to search wikipedia and get the info it searches for and put it into a large string and output into a file. How can I do that in C++? Any info please tell? need more anwsers please
Use wget with the query URL
wget --output-document=result.html http://en.wikipedia.org/wiki/Special:Search?search=jon+skeet&go=Go
This searches for jon skeet and stores the result in result.html
To use it from C++ you can e.g. use the system() call to execute wget in a seperate process.
libcURL is pretty popular. I don't know that the interface is especially object-oriented, but it's certainly usable from C++.
There are a number of client APIs for MediaWiki (the wiki engine that powers Wikipedia). Here's a listing. They provide the ability to create/delete/edit/search articles. Nothing in straight C++ but it still may be useful.
DotNetWikiBot was quite useful on one project that I had...