-
m_dir = system("dir c:")
I have this line of code:
m_dir = system("dir c:")
and m_dir is a char variable for an edit box. It looks like the directory is being done in a command type box seperate from the dialog program that I want the code in. Well, I just can't seem to make this work. Am I doing this the wrong way?
Thanks,
Ray Schmidt
-
As you're creating a GUI app, you won't be wanting system(), which you're using incorrectly anyway.
Lookup findfirstfile and findnextfile. Or do a board search.
-
FindNextFile
Ok, thank you for the start. I've gotten the first file to show up and have tried some loops and other junk with the "FindNextFile". The problem now is I keep overwriting my edit box variable m_dir. How can I keep each file listed in the box??? Can someone please help here???
This is what I've got...
Code:
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
//select & open file
if(m_quote == 0)
{
// Quote Directory
sprintf(file,"c:/mydocu~1/programming/peekaview/%s.tre",m_truss);
hFind = FindFirstFile("c:/mydocu~1/programming/peekaview/debug/*.tre", &FindFileData);
m_dir = FindFileData.cFileName;
FindNextFile(hFind, &FindFileData);
m_dir = FindFileData.cFileName;
if( (stream = fopen(file,"r")) == NULL )
{
MessageBox(" Trusses Not Found!\nFill In The Information Below", "Error", MB_ICONEXCLAMATION);
return;
}
}
FindClose(hFind);
fclose(stream);
-
Heres a knock up I did for someone else.
>>> How can I keep each file listed in the box
Store the results in an array? Write them to a list box rather than an edit box? Depends what you want to do with it really.
-
Let me ask a dumb question. If my list box ID is IDC_DIR and a char variable of m_dir, how can I use, "myListbox.addItem("Item");" to get the desired information into it??? I've tried the what I thought to be the obvious (wrong!)... Can someone help???