Thread: m_dir = system("dir c:")

  1. #1
    Registered User Ray Schmidt's Avatar
    Join Date
    Feb 2003
    Posts
    17

    Question 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

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    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.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User Ray Schmidt's Avatar
    Join Date
    Feb 2003
    Posts
    17

    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);
    Last edited by Ray Schmidt; 03-08-2003 at 10:55 PM.

  4. #4
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    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.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  5. #5
    Registered User Ray Schmidt's Avatar
    Join Date
    Feb 2003
    Posts
    17
    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???

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 11-29-2008, 11:45 PM