I need to debug an embedded C-application that contains a lot of the following structs:
I have ported the code into a Visual Studio 2005 console application and I would like to dump all the struct-members (several hundred in total) to a text-file like this:
MyStruct.MySubStruct.MyEnum = MyEnumValue
I know this isn't possible in pure Visual Studio c programming language, but aren't you allowed to include C++ files as well in a Visual Studio console project? If so, is C++ capable of converting struct members and enums into text strings?
And your code above does not make clear what the problem is in sending the struct contents to a text file. Generally speaking you need to write the code to dump each element of the struct. Or you could just run the program in the Visual Studio debugger and examine the fields that way.
However you are not really giving me enough information. You need to be very specific when you ask for help. Do you need to do this on a Release build or Debug build? Do you need to do this at run-time or compile-time?
1.) Preprocessor abuse[^] that stores the variable name in an extra char field in the struct. Here is a partial example[^].
2.) If you are using C++ there are several boost libs[^] that allow you to implement some reflection.
3.) The Debug Interface Access SDK[^] can be used to get all of the structs and member variable names. If you go this route... you will need to generate a PDB.
If this is a debug tool I recommend that you check out the Debug Interface Access SDK[^] which will allow you to get all kinds of useful information and statistics about your executable. You can dump each function/class size and type along with the variable name.
I need to "send" data in a notepad every time I write double numbers on edit control and press save. I wrote some code but my dialog (where the edit control is) don't even open when I run the executable. What I've done so far:
// TODO: If this is a RICHEDIT control, the control will not// send this notification unless you override the CDialog::OnInitDialog()// function and call CRichEditCtrl().SetEventMask()// with the ENM_CHANGE flag ORed into the mask.// TODO: Add your control notification handler code here
I think I must write some code here so the dialog box work fine but I can't it.
// TODO: Add your command handler code here
CInputDoc* pDoc = GetDocument();
Just get the text from the edit box using GetWindowText:
// If you have a class member variable for the CEdit in your CDataDialog class:
// If not, you have to use the ID:
CEdit *pEdit = (CEdit*)GetDlgItem(IDC_OF_THE_EDIT_BOX);
I did it but I didn't manage to save them again. Also when I pressed <x> this message appeared: "Exception thrown at 0x104420C5 (mfc140ud.dll) in Input.exe: 0xC0000005: Access violation reading location 0x00000020.
If there is a handler for this exception, the program may be safely continued.------>Break, Continue, Ignore"
Then use the debugger to see what happens (e.g. by setting a break point somewhere after the output file has been selected using the CFileDialog). You might also check if file.Open was successful. But if that fails calling file.WriteString should throw an execption.
How can I give data in a dialog box dynamically? In a previous project I used edit boxes (e.g for 3 conductors) and gave those data separately for each conductor but now I have to give them dynamically and I don't have standard number of conductors and I can't use edit box again. Could you please give me an idea or a good link describing step by step how to create a table in a dialog box dynamically?
Thanks for your time!!
Last Visit: 31-Dec-99 18:00 Last Update: 22-Sep-23 14:39