Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
C++CodeIDE

C++Builder Developer on StackOverflow was having trouble with SysUtils FindFirst / FindNext not finding all files with extension ~1~ and other strange file extensions.

Here was my answer 😀

Create a New | C++Builder VCL Windows application. On the form add TPanel, TButton, TEdit and TMemo components. Put the TButton and TEdit into the TPanel. Set TPanel align property to AlTop. Set the TMemo align property to alClient.

FindFirst’s declaration in SysUtils.hpp is:

The key point is to included any or all of the file attributes (integer parameter Attr) for files that you want to find. The file attribute choices are defined in “C:\Program Files (x86)\Embarcadero\Studio\21.0\include\windows\rtl\windows\rtl\System.SysUtils.hpp”:

The following code will display all items in a directory including the ., .., .~* files – for example in a C++Builder project’s history folder.

I put the string: C:\Users\david\Documents\Embarcadero\Studio\Projects\CBuilder\FindFirstVCLCpp\__history\*.* in the EditBox. After clicking the Button, the TMemo contained the following contents.

Screen Grab of running C++Builder FindFirst app

References

System.SysUtils.FindFirst

System.SysUtils.FindNext

To find more C++Builder StackOverflow questions and answers use the C++Builder SO Tag 😀

See What's New in 12.2 Athens See What's New in 12.2 Athens Dev Days of Summer 2-24

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES