Click here to Skip to main content
16,005,389 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Creating a .docx file programatically? Pin
led mike30-May-08 6:13
led mike30-May-08 6:13 
AnswerRe: Creating a .docx file programatically? Pin
David Crow30-May-08 7:56
David Crow30-May-08 7:56 
QuestionError with CArray, CMap Pin
Trupti Mehta30-May-08 4:44
Trupti Mehta30-May-08 4:44 
QuestionRe: Error with CArray, CMap Pin
David Crow30-May-08 4:59
David Crow30-May-08 4:59 
AnswerRe: Error with CArray, CMap Pin
Jijo.Raj30-May-08 5:52
Jijo.Raj30-May-08 5:52 
GeneralRe: Error with CArray, CMap Pin
Trupti Mehta30-May-08 22:41
Trupti Mehta30-May-08 22:41 
GeneralRe: Error with CArray, CMap Pin
Jijo.Raj30-May-08 23:16
Jijo.Raj30-May-08 23:16 
GeneralRe: Error with CArray, CMap Pin
Trupti Mehta31-May-08 0:38
Trupti Mehta31-May-08 0:38 
Thanks Jijo,

But this didn't solve the Map error of the followng function:
void DbOperations::WriteDepartments(CMapStringToPtr dptMap)
{
	HANDLE hFile = CreateFile(DEPT_FILE,
	     GENERIC_WRITE, FILE_SHARE_WRITE,
         NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);

	if (hFile == INVALID_HANDLE_VALUE)
		AfxMessageBox(_T("Error OPeniong File"));
	else {
		CFile myfile((int)hFile);
		CString key;
		DeptDetails* dd;

		CArchive ar(&myfile, CArchive::store);

		for (POSITION pos = dptMap.GetStartPosition(); pos != NULL;) {
			dptMap.GetNextAssoc(pos, key, (DeptDetails&)dd ); //.GetNextAssoc(pos, key, (DeptDetails*&)dd);
			dd->Serialize(ar);		
		}
		
		key.Empty();
		dd->~DeptDetails();
		myfile.Close();
	}

	return;
}

On GetNextAssoc method, I still get :
error C2664: 'GetNextAssoc' : cannot convert parameter 3 from 'class DeptDetails *' to 'void *& '
        A reference that is not to 'const' cannot be bound to a non-lvalue
Error executing clarm.exe.


How to resolve this error yet? Do i have to write another operator= for DeptDetails*. Can you let me know the code so I don't make mistake again.

I highly appreciate for your quick and helpful responses.

One more query I have:
I wanted to store deptNo (int) as key & DeptDetails as value in a Map. I looked at CMap but couldn't find any method to iterate the map contents, hence selected CMapStringToPtr seemed to be best suited to store deptNo in the form of CString. Is this decision correct or should I approach some other class of CMap.

Thanks

Terry

GeneralRe: Error with CArray, CMap Pin
Jijo.Raj31-May-08 6:28
Jijo.Raj31-May-08 6:28 
GeneralRe: Error with CArray, CMap Pin
Trupti Mehta1-Jun-08 0:05
Trupti Mehta1-Jun-08 0:05 
GeneralRe: Error with CArray, CMap Pin
Jijo.Raj1-Jun-08 1:59
Jijo.Raj1-Jun-08 1:59 
GeneralRe: Error with CArray, CMap Pin
Trupti Mehta1-Jun-08 8:57
Trupti Mehta1-Jun-08 8:57 
GeneralRe: Error with CArray, CMap Pin
Jijo.Raj1-Jun-08 23:11
Jijo.Raj1-Jun-08 23:11 
GeneralRe: Error with CArray, CMap Pin
Trupti Mehta2-Jun-08 2:09
Trupti Mehta2-Jun-08 2:09 
GeneralRe: Error with CArray, CMap Pin
Jijo.Raj2-Jun-08 4:27
Jijo.Raj2-Jun-08 4:27 
QuestionCannot run the exe of my application Pin
vijay_aroli30-May-08 2:55
vijay_aroli30-May-08 2:55 
QuestionRe: Cannot run the exe of my application Pin
David Crow30-May-08 3:15
David Crow30-May-08 3:15 
AnswerRe: Cannot run the exe of my application Pin
Mike Dimmick30-May-08 7:16
Mike Dimmick30-May-08 7:16 
QuestionHow to remove a folder and all its contents Pin
piul30-May-08 0:25
piul30-May-08 0:25 
QuestionRe: How to remove a folder and all its contents Pin
CPallini30-May-08 0:32
mveCPallini30-May-08 0:32 
AnswerRe: How to remove a folder and all its contents Pin
piul30-May-08 0:44
piul30-May-08 0:44 
GeneralRe: How to remove a folder and all its contents Pin
CPallini30-May-08 0:59
mveCPallini30-May-08 0:59 
GeneralRe: How to remove a folder and all its contents Pin
piul30-May-08 1:05
piul30-May-08 1:05 
AnswerRe: How to remove a folder and all its contents Pin
vijay_aroli30-May-08 0:59
vijay_aroli30-May-08 0:59 
AnswerRe: How to remove a folder and all its contents Pin
Michael Schubert30-May-08 1:43
Michael Schubert30-May-08 1:43 

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.