Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Debugging a call to a function from OnButton1 Event

Posted on 2004-10-25
3
Medium Priority
?
261 Views
Last Modified: 2013-11-20
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);
}
0
Comment
Question by:vivekpara
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
jimwasson earned 1000 total points
ID: 12403830
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
 
LVL 2

Author Comment

by:vivekpara
ID: 12404019
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
 
LVL 7

Expert Comment

by:jimwasson
ID: 12404222
No problem. It happens to me a lot!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question