Click here to Skip to main content
15,888,113 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CRecordView Display Pin
David Crow28-Aug-06 4:22
David Crow28-Aug-06 4:22 
QuestionHow to use recompiled header file? Pin
Super Lloyd27-Aug-06 4:09
Super Lloyd27-Aug-06 4:09 
AnswerRe: How to use recompiled header file? Pin
Waldermort27-Aug-06 4:35
Waldermort27-Aug-06 4:35 
QuestionToolbar Control Pin
mehrdadov27-Aug-06 2:29
mehrdadov27-Aug-06 2:29 
AnswerRe: Toolbar Control Pin
Christian Graus27-Aug-06 2:59
protectorChristian Graus27-Aug-06 2:59 
GeneralRe: Toolbar Control Pin
mehrdadov27-Aug-06 20:23
mehrdadov27-Aug-06 20:23 
GeneralRe: Toolbar Control Pin
Hamid_RT27-Aug-06 21:27
Hamid_RT27-Aug-06 21:27 
Questionassigning strings to dynamic arrays Pin
jon-8027-Aug-06 1:47
professionaljon-8027-Aug-06 1:47 
As part of a sort algorithm I am copying the contents of a vector to a local dynamic array (temporarily) prior to sorting them (using a simple algorithm such as bubble sort).

CSentenceList.h
--------------------------------------------
class CSentenceList
{

public:
...
//Properties
unsigned int Size;
vector<string> Sentences; //list of sentences
...
private:
...

//Properties
string* m_tempList; //used for sort
};


CSentenceList.cpp
--------------------------------------------
....
void CSentenceList::sort()
{ m_tempList = new string[Size];

//copy Sentences to m_tempList
for (int iIndex = 0; iIndex = Size; iIndex++)
{m_tempList[iIndex] = Sentences[iIndex];} // ERROR!

Sentences.clear();

// sort the array
...

delete [] m_tempList;
}

However the code breaks during the assignment of the contents of the vector to the dynamic array (memcpy.asm), when trying to read from memory.

Error: Access violation reading location 0xabababab.

I am declaring m_tempList as a string* otherwise I wouldn't be able to create the array using the 'new[]' operator.

Any ideas? Any simpler way to sort?



Jon
AnswerRe: assigning strings to dynamic arrays Pin
Christian Graus27-Aug-06 2:14
protectorChristian Graus27-Aug-06 2:14 
AnswerRe: assigning strings to dynamic arrays Pin
krmed27-Aug-06 4:37
krmed27-Aug-06 4:37 
AnswerRe: assigning strings to dynamic arrays Pin
Hamid_RT28-Aug-06 7:38
Hamid_RT28-Aug-06 7:38 
QuestionWindows XP made VC++ Application not running in Windows 2000 Professional...?? Pin
siddhen26-Aug-06 21:48
siddhen26-Aug-06 21:48 
AnswerRe: Windows XP made VC++ Application not running in Windows 2000 Professional...?? Pin
Christian Graus26-Aug-06 22:08
protectorChristian Graus26-Aug-06 22:08 
AnswerRe: Windows XP made VC++ Application not running in Windows 2000 Professional...?? Pin
Andy Moore27-Aug-06 9:59
Andy Moore27-Aug-06 9:59 
AnswerRe: Windows XP made VC++ Application not running in Windows 2000 Professional...?? Pin
Hamid_RT28-Aug-06 7:37
Hamid_RT28-Aug-06 7:37 
QuestionCan't open program in another PC Pin
Max++26-Aug-06 19:14
Max++26-Aug-06 19:14 
AnswerRe: Can't open program in another PC Pin
Mircea Puiu26-Aug-06 20:13
Mircea Puiu26-Aug-06 20:13 
GeneralRe: Can't open program in another PC Pin
Max++26-Aug-06 20:33
Max++26-Aug-06 20:33 
GeneralRe: Can't open program in another PC Pin
Christian Graus26-Aug-06 20:45
protectorChristian Graus26-Aug-06 20:45 
AnswerRe: Can't open program in another PC Pin
siddhen26-Aug-06 21:44
siddhen26-Aug-06 21:44 
GeneralRe: Can't open program in another PC Pin
Christian Graus26-Aug-06 22:10
protectorChristian Graus26-Aug-06 22:10 
AnswerRe: Can't open program in another PC Pin
Trollslayer27-Aug-06 3:27
mentorTrollslayer27-Aug-06 3:27 
GeneralRe: Can't open program in another PC Pin
Max++27-Aug-06 3:35
Max++27-Aug-06 3:35 
GeneralRe: Can't open program in another PC Pin
BlitzPackage27-Aug-06 15:59
BlitzPackage27-Aug-06 15:59 
GeneralRe: Can't open program in another PC Pin
Hamid_RT28-Aug-06 7:31
Hamid_RT28-Aug-06 7:31 

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.