Problem with TStringList and GetFileNames function

X

Xoomer

This is what I need to do, Pass the path, type in and a TStringList
pointer into the function. The caller must create and delete the
TString list, this function simply fills it with filenames and their
directory. If the Boolean is true, the TStringList of filenames will
return in random order otherwise they will return in the order they
are stored in the directory.

Problem with both lines:
TStringList* LIST = new TStringList();
Test.GetFileNames("*.jpg","c:\\pics",LIST, true);

Code
---

MAIN
==================
C_Random Test;

void __fastcall TForm1::Open1Click(TObject *Sender)
{
if (!OpenPictureDialog1->Execute()) return;
AnsiString FileExt = ExtractFileExt(OpenPictureDialog1->FileName);


//PROBLEM HERE!!!
TStringList* LIST = new TStringList(); // IS THIS RIGHT?
Test.GetFileNames("*.jpg","c:\\pics",LIST, true);
}

=================

Class File
==-=======

class C_Random
{
public:


//int GetFileNames(AnsiString Type, // e.g.
"*.jpg"
//AnsiString Dir, // e.g. "c:\\photos"
//TStringList* FileNamesList, // Return the list of
filenames
//bool Random = true); // Randomise the list
if true

int GetFileNames(AnsiString Type, AnsiString Dir, TStringList*
FileNamesList, bool Random = true);

private:
};



int C_Random::GetFileNames(AnsiString Type, AnsiString Dir,
TStringList* FileNamesList, bool Random)
{
//
}
 
J

Jack Klein

This is what I need to do, Pass the path, type in and a TStringList
pointer into the function. The caller must create and delete the
TString list, this function simply fills it with filenames and their
directory. If the Boolean is true, the TStringList of filenames will
return in random order otherwise they will return in the order they
are stored in the directory.

[snip]

What you need to do is ask this question in Windows programming group,
like because the things you
are asking about are Microsoft specific and not defined by the C++
language.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top