Link to home
Start Free TrialLog in
Avatar of titanium0203
titanium0203

asked on

How to read files from a folder?

Hi,

Any Ideas on how to read content(header) of multiple files from one folder? and based on that data construct another files in the same folder.

regards,
titanium0203
SOLUTION
Avatar of trinitrotoluene
trinitrotoluene
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of titanium0203
titanium0203

ASKER

Hi trinitrotoluene,

Thanks for the infos, but how can I use read or readstring to grab first 5 bytes or 20 characters in a binary files? I tried both functions but its not working.

thanks
Hi all

I got error as below when try to pass second argument in readstring.

code :
while(output.Readstring(Buffer1,100)
{
....
{

Error :

C:\temp\ListFile\ListFile.cpp(112) : error C2664: 'char *__thiscall CStdioFile::ReadString(char *,unsigned int)' : cannot convert parameter 1 from 'class CString' to 'char *'
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\temp\ListFile\ListFile.cpp(112) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Error executing cl.exe.
Hi there,
Using C++ Builder (whatever version >= 5) and of course windows OS:
Drop a TFileListBox in the form visible or not.
Set the Directory to the path of the folder.
There will be a string list contains the paths of every file inside the folder.
Using a TMemoryStream and LoadFromFile() function you are loading the file.
Accessing the Memory property (array of binary data) you can examine the content.
You can use the same TMemoryStream object to clear and load another (or the next) file...
Thats for using C++ Builder.
Similar with Delphi.
I am sure that VC++ has similar ways...

George Tokas.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial