Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>C++ is a language that does not specify any standard classes or functions for implementing graphical interfaces. It also doesn't provide a standard way of getting lists of files and directories from the operating system!!! In fact...for a long time there wasn't even a standard for string classes, and every project chose different incompatible strings.</p> <p><em>Note: Even though there's now a standard <code>string</code> class, the fragmented legacy continues: <a href="https://stackoverflow.com/questions/1618798/why-is-there-a-different-string-class-in-every-c-platform-out-there">Why is there a different string class in every C++ platform out there?</a></em></p> <p>So when you tag something "C++" or use that term, it refers only the language engine itself. As limited as that may sound, one of the great strengths is that this engine is so (relatively) powerful that you don't <em>need</em> to build things in to make them efficient or have a deep coding interface. Users of the language have nearly as much power to create cool language features as if they were able to modify the compiler itself.</p> <p>It's a steep hill to climb for beginners, though.</p> <hr> <p>All of that means that a question like <em>"How to populate a Listbox in C++ with all folders in a directory?"</em> is very open-ended. It depends on what toolkits you're choosing to use for the GUI, and for talking to the filesystem. Some toolkits are "big" and offer comprehensive classes to cover both areas:</p> <p><a href="http://doc.qt.nokia.com/latest/qdir.html#navigation-and-directory-operations" rel="nofollow noreferrer">http://doc.qt.nokia.com/latest/qdir.html#navigation-and-directory-operations</a></p> <p><a href="http://doc.qt.nokia.com/latest/itemviews-dirview.html" rel="nofollow noreferrer">http://doc.qt.nokia.com/latest/itemviews-dirview.html</a></p> <p>Other libraries are more narrow and provide just one function or another. For instance, "boost" is a set of <em>almost</em> standard libraries that haven't yet made it into the C++ spec. There's a way to enumerate files and directories with C++ using <code>boost::filesystem</code>. It's daunting for beginners, though:</p> <p><a href="http://www.boost.org/doc/libs/1_48_0/libs/filesystem/v3/doc/tutorial.html" rel="nofollow noreferrer">http://www.boost.org/doc/libs/1_48_0/libs/filesystem/v3/doc/tutorial.html</a></p> <p>If you're willing to chain yourself to a particular operating system or implementation--such as make calls to functions only available on Windows, or only on Linux under GTK, or only on MacOS--then you have access to what that platform+toolkit provides. But because C++ is platform-independent, once you cross that line you're no longer programming in "just C++" and your question and tags on StackOverflow need to clarify what choices you've made.</p> <p>Your other questions on SO are about Visual Studio and VB so I'm assuming you're using Windows.</p> <hr> <p>One related topic you should be aware of are "common dialogs". These are conveniences provided so that everyone doesn't have to write their own "File->Open" logic, or color picker, or search dialog. Microsoft has some of them defined on Windows:</p> <p><a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms646960(v=VS.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/windows/desktop/ms646960(v=VS.85).aspx</a></p> <p>So if picking a file, files, directory, or directories is the simple purpose of some code...those save you the trouble. Qt has similar things:</p> <p><a href="http://doc.qt.nokia.com/stable/qfiledialog.html#details" rel="nofollow noreferrer">http://doc.qt.nokia.com/stable/qfiledialog.html#details</a></p> <hr> <p>You can edit your question to add more about your purposes. If you are curious about C++ and just want to dive in and have a well-documented set of functionality that will work on Windows, Mac, or Linux... consider trying Qt Creator:</p> <p><a href="http://www.qt.io/ide/" rel="nofollow noreferrer">http://www.qt.io/ide/</a></p> <p>Microsoft has really hinged their strategy on .NET and C#, so at least right now you'll stand on firmer ground as a C++ GUI programmer if you go with Qt.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload