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

C / C++ / MFC

 
QuestionUsing GetOpenFileName on both Win98 and WinXP Pin
Patcher3214-Oct-09 12:34
Patcher3214-Oct-09 12:34 
QuestionRe: Using GetOpenFileName on both Win98 and WinXP Pin
«_Superman_»14-Oct-09 12:51
professional«_Superman_»14-Oct-09 12:51 
GeneralRe: Using GetOpenFileName on both Win98 and WinXP Pin
Patcher3214-Oct-09 12:55
Patcher3214-Oct-09 12:55 
GeneralRe: Using GetOpenFileName on both Win98 and WinXP Pin
«_Superman_»14-Oct-09 12:58
professional«_Superman_»14-Oct-09 12:58 
GeneralRe: Using GetOpenFileName on both Win98 and WinXP Pin
Patcher3214-Oct-09 13:03
Patcher3214-Oct-09 13:03 
GeneralRe: Using GetOpenFileName on both Win98 and WinXP Pin
Ozer Karaagac14-Oct-09 14:57
professionalOzer Karaagac14-Oct-09 14:57 
AnswerRe: Using GetOpenFileName on both Win98 and WinXP Pin
Richard MacCutchan14-Oct-09 22:23
mveRichard MacCutchan14-Oct-09 22:23 
QuestionSorting a list in VC++ Pin
Anderson Jogie14-Oct-09 12:07
Anderson Jogie14-Oct-09 12:07 
I am trying to sort a list using the insertion sort algo, but my application crashes. I think those pointers lost track by using the remove function. Is there a better way to sort except using the sort() (list.sort() function). It does not work too well with it since I am sorting by Departure Time of the object in the list.
Here is the code i wrote:

//Insertion sort to sort runs by departure time in the Res_RunList
int numruns = Res_RunList.size(); //the size of the list
ListOfRuns::iterator Tempitr1; //create itr poniters to navigate thru the list
ListOfRuns::iterator Tempitr2;
ListOfRuns::iterator Tempitr3;
ListOfRuns::iterator Tempitr4;
ListOfRuns::iterator Tempitr5;
ListOfRuns::iterator Tempitr6;
std::list <RDLRun*> TempList;
ListOfRuns::iterator Tempitr7;


Tempitr1 = Res_RunList.begin(); //points to the 1st element
Tempitr2 = Res_RunList.begin();
Tempitr6 = Res_RunList.begin();

for(int low = 1; low < numruns; ++low)
{
++Tempitr2; //points to low position

RDLRun *TempRun = (*Tempitr2); // store the data from low position in TempRun

int u = low -1;
Tempitr3 = Tempitr2;
Tempitr4 = Tempitr3--; //ponits to u position
//compare the time windows
while(u >=0 && ( (*Tempitr4)->GetDepartureTime() > TempRun->GetDepartureTime() ) )
{
Tempitr5 = Tempitr4;
Res_RunList.insert(Tempitr5++, (*Tempitr4));
Res_RunList.remove((*Tempitr5++));//to prevent duplicate
--u;
--Tempitr3;
}//end while loop

if(u > 0 || TempRun->GetDepartureTime() > (*Tempitr1)->GetDepartureTime())
{ Res_RunList.insert(Tempitr4++, TempRun);
Res_RunList.remove((*Tempitr4++));
}
else{
Res_RunList.insert(Tempitr6++, (*Tempitr1));
Res_RunList.remove((*Tempitr6++)); Res_RunList.insert(Tempitr1, TempRun);
}


}//end for loop


Thanks. Wink | ;)
AnswerRe: Sorting a list in VC++ Pin
«_Superman_»14-Oct-09 12:54
professional«_Superman_»14-Oct-09 12:54 
GeneralRe: Sorting a list in VC++ Pin
Anderson Jogie15-Oct-09 4:56
Anderson Jogie15-Oct-09 4:56 
AnswerRe: Sorting a list in VC++ Pin
«_Superman_»15-Oct-09 6:31
professional«_Superman_»15-Oct-09 6:31 
GeneralRe: Sorting a list in VC++ Pin
Anderson Jogie19-Oct-09 11:38
Anderson Jogie19-Oct-09 11:38 
Questionhow to let ado's data import to ms-word and then print Pin
yugiant14-Oct-09 6:15
yugiant14-Oct-09 6:15 
AnswerRe: how to let ado's data import to ms-word and then print Pin
David Crow14-Oct-09 7:35
David Crow14-Oct-09 7:35 
Questionchange code inside function body of dll file, dangerous? Pin
includeh1014-Oct-09 5:58
includeh1014-Oct-09 5:58 
AnswerRe: change code inside function body of dll file, dangerous? Pin
Randor 14-Oct-09 6:54
professional Randor 14-Oct-09 6:54 
AnswerRe: change code inside function body of dll file, dangerous? Pin
Rajesh R Subramanian14-Oct-09 7:49
professionalRajesh R Subramanian14-Oct-09 7:49 
AnswerRe: change code inside function body of dll file, dangerous? Pin
Moak14-Oct-09 9:49
Moak14-Oct-09 9:49 
Questioncalculation error Pin
kbury14-Oct-09 5:13
kbury14-Oct-09 5:13 
AnswerRe: calculation error Pin
CPallini14-Oct-09 5:37
mveCPallini14-Oct-09 5:37 
GeneralRe: calculation error Pin
kbury14-Oct-09 5:43
kbury14-Oct-09 5:43 
GeneralRe: calculation error Pin
CPallini14-Oct-09 7:04
mveCPallini14-Oct-09 7:04 
AnswerRe: calculation error Pin
David Crow14-Oct-09 7:39
David Crow14-Oct-09 7:39 
AnswerRe: calculation error [modified] Pin
Patcher3214-Oct-09 12:52
Patcher3214-Oct-09 12:52 
AnswerRe: calculation error Pin
Luc Pattyn14-Oct-09 13:41
sitebuilderLuc Pattyn14-Oct-09 13:41 

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.