Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
As a first time programming using vi with a raw Linux terminal in C++, what is the simplest way to recurse through a filesystem and get results such as file size, date, directory date etc?
I imagine I'm missing a library or two that would handle this pretty cleanly which would be great to know. Even better would be knowing where to find a solid reference for the basics like this.
If you have a modern compiler you can use std::filesystem:
https://en.cppreference.com/w/cpp/filesystem
Otherwise you can use boost::filesystem, which is very similar but non standard:
https://www.boost.org/doc/libs/1_67_0/libs/filesystem/doc/index.htm
Boost is a collection of libraries with various purposes and a focus on quality. Boost libraries regularly end up in the new C++ standards so it's good thing to learn.
You might consider (on Linux at least) to use nftw(3). You could use opendir(3) + readdir(3) + closedir with stat(2) (and nftw is using all these). See also syscalls(2) (and read some Linux programming book, perhaps the old ALP). Notice that on Linux (and POSIX systems), the operating system API is in C, not in C++.
Of course, you might use the C++ functions given in f4's answer (they are are based on functions above).
And you could use C++ frameworks such as boost, poco, Qt (also using the functions above).
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
Is there any nice to read Linux API reference like the one offered by MSDN or boost? I like the detailed information about the parameters from MSDN and the pre- an post conditions from the boost documentation. But until now I found nothing comparable in the net for Linux.
The man pages are definitely a good start, as others have noted. If you'd like something more formal and rigorous, however, I would recommend reading the POSIX specification. Here is the index of functions in the standard:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/contents.html
Looking at what the standard requires, rather than what the current implementations of these functions on Linux happen to do, will also help you write more portable, robust software.
Read first good books like Advanced Linux Programming (you can download it) and Advanced Unix Programming
Be aware that GNU/Linux is by definition less monolithic than Windows (because many contributors are working on it, and) because it is made of many independent programs.
Therefore, there is no well defined Linux API (except for the kernel syscalls; but GNU/Linux is more than the kernel)
Of course, read the man pages, in particular start with the intro(2) man page about syscalls and other man-pages.
Be aware that Linux is nearly implementing (a superset of) the POSIX standard specification from the OpenGroup.
Read also many good documentations from TLDP.
If you are interested by desktop application development, understand first what
X11 is, (beware, X11 is very complex in the details). Then read documentation from freedesktop. Better yet, learn to use a graphical toolkit like Qt or Gtk
And GNU/Linux is made of free software, you can download and study the source code and improve it. You'll very often use some existing free software library, and you may study its source code (and each of them has its own documentation). Part of your work is finding good free software related to your needs. freecode and sourceforge are good resources (and they are many others).
I have this bookmarked.
The Linux man-pages project
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I am writing an application in which I need to be able to browse for an existing file and to create a new one. I need to create user interface for that. Is there any good cross-platform free library to help me do that?
If you're not already using a cross-platform UI library, then it doesn't make a lot of sense to introduce a dependency upon a huge library just to display a file dialog.
Since recommendations for a cross-platform UI library have already been hashed out repeatedly in other questions (use the search feature to find them if you're interested) and are probably off-topic anyway,
I'm going to take the liberty of assuming that such is not your question.
Therefore, the answer is that no, there is no reliable, cross-platform way of creating a file dialog. Each platform provides a different interface/API for this, so you'll need to write code to detect the current platform and then display the dialog as instructed by each platform's documentation.
You can do this either at run-time (if you want to have a single binary), or at compile-time by using conditional compilation (#if statements).
This is basically all that any UI library would be doing, and for such a simple requirement (a single feature) it makes sense to me at least to just do that work yourself.
You can give wxWidgets a try, a GUI library in C++, free, open-source,... and work with the native graphics libraries.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Is there any portable c++ library to work with the filesystem?
I know about boost::filesystem, but I need to know if there is any other.
Thanks!
POCO has similar functionality which you can find under Foundation/FileSystem.
There is at least one more solution worth mentioning - STLSoft, a set of BSD-like licensed libraries, contains a cross-platform wrapper under Windows & Unix native filesystem APIs - PlatformSTL project. The benefit in comparison with boost::filesystem is no need to build anything, the whole library is header-only, you can simply include it in your project. The bad side is lack of documentation though, I spent quite some time to figure out how to use it.
What about QT's QFileSystemModel or QFSFileEngine?
You can find it in the SSVUtils library: https://github.com/SuperV1234/SSVUtils
I found that for an application which needs a lot more than the filesystem API defined in the language it makes sense to encapsulate the filesystem API yourself and on a per application level.
Because in this case you usually need some very specific features (you surely do on the iPhone/MacOSX) and this will be not very portable and also missed by boost and others. In this case you need to go a bit higher in your abstraction layer.
Today the operating system API isn't that bad anymore. Writing a wrapper shouldn't take long.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
There is a list of C++ XMLRPC implementations in Wikipedia:
Libiqxmlrpc
Ultra lightweight XML-RPC library for C++
XML-RPC for C and C++
XmlRpc++
XmlRpc C++ client for Windows
gSOAP toolkit for C and C++ supporting XML-RPC and more
libmaia: XML-RPC for Qt/C++
I wonder that people use which of these libraries most. Do you have experience with these libraries?
I've used gSOAP in the past. I found it pretty nice to work with. It's fairly mature and runs on a variety of platforms. I thought the documentation, along with examples to be sufficient. We used it on a project that needed to communicate with ASP.NET web services from a Linux environment.
I think that xmlrpc++ is what you're looking for. Though I can't give objective comparison to every library listed here, I must say that's it's extremely versatile, well-written and somewhat easy to get used to.
Well, it actually some kind of lacks in documentation, but this is also subjective (hate this doxygenized way of presenting information).
Added : ulxmlrpcpp also (never used it, just looked through documentation) seems fine and well-designed.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Is there any documentation on qpThreads? In what way is it different from pthreads?
It looks like qpthread has become a sourceforge project. It hasn't changed in four or five years from the CVS repository and doesn't seem to contain any documentation. Chances are that if you don't have docs on it, then none exist save for the source code and headers of course.
I grabbed the source out of curiosity and it looks like a pretty standard threading implementation that is layered over pthreads. The largest difference is that pthreads is a C-style interface and qpThreads is an OO interface more akin to what you might find in Java. I haven't delved into it very deeply, but you might want to look at the interfaces like java.util.Timer and java.util.concurrent. Some of the interfaces look quite similar to what qpThreads offers.
You might want to investigate replacing it with Boost.thread or something more recent. Chances are that you will have better luck maintaining it. It shouldn't be that hard to do depending on how much code you have to deal with.
From a cursory look at google search results, qpThreads seems to be an obscure C++ threading class library. pthreads is a very widely used, POSIX-compliant, multi-platform threading C API.
The most important thing about using libraries is making sure they are actively maintained.
You should use a well known and heavily used library if possible. This way you will also have a vast number of people to ask questions if you have any.
Please see this similar SO question for more details:
Good c++ lib for threading (or use the search box for more).
Found some documentation finally.
Sourceforge qpthreads