Click here to Skip to main content
15,914,221 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: get type of a value of a sys registry Pin
David Crow15-Oct-03 3:42
David Crow15-Oct-03 3:42 
GeneralRe: get type of a value of a sys registry Pin
ranjjj15-Oct-03 18:27
ranjjj15-Oct-03 18:27 
GeneralRe: get type of a value of a sys registry Pin
David Crow16-Oct-03 2:30
David Crow16-Oct-03 2:30 
GeneralRe: get type of a value of a sys registry Pin
ranjjj15-Oct-03 18:27
ranjjj15-Oct-03 18:27 
QuestionHow to enable/disable menu items in a dialog-based app? Pin
tabor2514-Oct-03 23:39
tabor2514-Oct-03 23:39 
AnswerRe: How to enable/disable menu items in a dialog-based app? Pin
Joaquín M López Muñoz15-Oct-03 0:05
Joaquín M López Muñoz15-Oct-03 0:05 
GeneralRe: How to enable/disable menu items in a dialog-based app? Pin
tabor2515-Oct-03 1:04
tabor2515-Oct-03 1:04 
GeneralSerialize/De-Serializing unicode file Pin
YaronNir14-Oct-03 23:00
YaronNir14-Oct-03 23:00 
Hi all,

I have a unicode file (strings.mc contains ids and langauge translations).

i wrote to methods to perfrom reading from and saving to this file:

void CMyClass::ReadingMCFile()
{
	FILE* fp = fopen(m_szMCFile, "rb");
	ASSERT(NULL != fp);
	if (NULL == fp)
	{
		AfxMessageBox((_T("Could not open the file : %s"),m_szMCFile),MB_ICONERROR);
		return;
	}

	wchar_t wcBuff[MAX_PATH];
	
	do
	{
		fgetws(wcBuff, MAX_PATH, fp);
		m_vecMCFile.push_back(wcBuff);
	} while(!feof(fp) );
   
	
	fclose(fp);
}


where m_vecMCFile is in the type of :

std::vector<wchar_t*>    m_vecMCFile;


now i wrote a method to write the changes back to the mc file (meaning going over the vector and write each line to the file as follows:

void CMyClass::WriteMCFile()
{
	if (!DeleteFile(m_szMCFile))
	{
		AfxMessageBox((_T("Could not delete the file : %s for writing "),m_szMCFile),MB_ICONERROR);
		return;
	}

	FILE* fp = fopen(m_szMCFile, "wb");
	ASSERT(NULL != fp);
	if (NULL == fp)
	{
		AfxMessageBox((_T("Could not open the file : %s"),m_szMCFile),MB_ICONERROR);
		return;
	}

	wchar_t* wcBuff = NULL;

	std :: vector<wchar_t*>::iterator vecIT;

	for (vecIT = m_vecMCFile.begin(); vecIT != m_vecMCFile.end(); vecIT++)
	{
		wcBuff = (*vecIT);
		fputws(wcBuff, fp);
	}    
	
	fclose(fp);
}


this code doesn't work...

can any1 help me fix it?

thanks in advanced

Yaron

Ask not what your application can do for you,
Ask what you can do for your application
Generalok i found the answer Pin
YaronNir14-Oct-03 23:30
YaronNir14-Oct-03 23:30 
GeneralRemoving white space in AutoRichEditCtrl after &quot;.&quot; Pin
ramya8314-Oct-03 22:26
ramya8314-Oct-03 22:26 
GeneralRe: Removing white space in AutoRichEditCtrl after &quot;.&quot; Pin
Fred D.15-Oct-03 1:27
Fred D.15-Oct-03 1:27 
General&quot;Transparent&quot; Control Pin
User-37793614-Oct-03 20:54
User-37793614-Oct-03 20:54 
QuestionCMDIFrameWnd active CMDIChildWnd? Pin
Dov Sherman14-Oct-03 20:18
Dov Sherman14-Oct-03 20:18 
QuestionHow Can I Do It Pin
maharsoft14-Oct-03 17:41
maharsoft14-Oct-03 17:41 
AnswerRe: How Can I Do It Pin
Joel Holdsworth14-Oct-03 23:12
Joel Holdsworth14-Oct-03 23:12 
QuestionHow do i transfer data to a property page? Pin
fynox14-Oct-03 17:03
fynox14-Oct-03 17:03 
AnswerRe: How do i transfer data to a property page? Pin
twing14-Oct-03 17:47
twing14-Oct-03 17:47 
GeneralRe: How do i transfer data to a property page? Pin
fynox14-Oct-03 19:24
fynox14-Oct-03 19:24 
GeneralRead all files in a specified directory Pin
hkl14-Oct-03 12:04
hkl14-Oct-03 12:04 
GeneralRe: Read all files in a specified directory Pin
Joel Holdsworth14-Oct-03 12:20
Joel Holdsworth14-Oct-03 12:20 
GeneralRe: Read all files in a specified directory Pin
hkl14-Oct-03 12:51
hkl14-Oct-03 12:51 
GeneralRe: Read all files in a specified directory Pin
David Crow15-Oct-03 7:59
David Crow15-Oct-03 7:59 
GeneralRe: Read all files in a specified directory Pin
vcplusplus14-Oct-03 12:25
vcplusplus14-Oct-03 12:25 
GeneralRe: Read all files in a specified directory Pin
hkl14-Oct-03 12:54
hkl14-Oct-03 12:54 
GeneralRe: Read all files in a specified directory Pin
georgiek5014-Oct-03 15:09
georgiek5014-Oct-03 15:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.