Debugging a call to a function from OnButton1 Event

I have a function that is called within an OnButton event.  When I place it in this function, it is skipped over in code and when I try to debug...but no errors are generated.  If I put the instructions of that function in the OnButton space, it works.  I can't figure out WHAT I'm doing wrong.  Does anyone have any ideas?

Here is the code:

void CUIMFCDlg::OnButton1()
{

                void Readcfgini();  //This is the call to the real function
                //This is the code for the function itself.  It returns data to my listbox
                //When I perform from here, it will actually execute the ScanDir Function and then return data to the list box.
      char **dirarray;
      char *scandir;
      scandir = "C:\\UI Code and Executable\\UIMFC\\UIMFC\\Debug\\programs";
      dirarray = 0;
      dirarray = ScanDir( scandir , 0);


      CString temp;
      for(int i=0;i<sizeof(dirarray);i++){
            temp.Format("%d", dirarray[i]);
            m_list.AddString(temp);}
}
//The called function
void Readcfgini()
{
      char **dirarray;
      char *scandir;
      scandir = "C:\\UI Code and Executable\\UIMFC\\UIMFC\\Debug\\programs";
      dirarray = 0;
      dirarray = ScanDir( scandir , 0);


      CString temp;
      for(int i=0;i<sizeof(dirarray);i++){
            temp.Format("%d",dirarray[i]);
            m_list.AddString(temp);
}
LVL 2
vivekparaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
jimwassonConnect With a Mentor Commented:
In OnButton1() you seem to have:

 void Readcfgini();  //This is the call to the real function

which is a declaration, not a call. Remove the "void" so you have

  Readcfgini();  //This is the call to the real function

0
 
vivekparaAuthor Commented:
Why copying and pasting can be a bad thing.

I swear I looked at it a million times and didn't notice that.  =)

Thank You!
0
 
jimwassonCommented:
No problem. It happens to me a lot!
0
All Courses

From novice to tech pro — start learning today.