>>f.write(str_name.GetBuffer(str_name.GetLength()),str_name.GetLength());
This will not help the problem you describe, but you should be using the >> operator for that, not the binary write() function.
f << (LPCTSTR)str_name << "\n";
Note that you don't need to call GetBuffer() because CString has overloaded the LPCTSTR operator that does similar thing -- when you use GetBuffer() you also should call ReleaseBuffer().
How much text are you attempting to add to one line of the ComboBox anyway? Maybe what you want is a list box which will show larger amount of text for each item.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
i have to add only one line at a time.what i need is add he item in second dialog to first dialog's combo box as soon as I hit "Add" button each time.
You might change the second dialog's constructor to take e.g. a pointer to the first dialog's CComboBox and then use that pointer to add each item in the second dialog i.e. something like
// in the first dialog box ...
// Pass in the address of the combobox (m_selcam) ...
Add cd(NULL, &m_selcam);
cd.DoModal();
/////////////////////////////////////////////
// in the second dialog box ...
...
GetDlgItemText(IDC_EDIT2,str_name);
// m_selcamPtr is a pointer to the combobox
// received via the dialog box's constructor
m_selcamPtr->AddString(str_name);
...
mitrmkar
Posting Virtuoso
1,809 posts since Nov 2007
Reputation Points: 1,105
Solved Threads: 395