Click here to Skip to main content
15,923,689 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionrun my exe after restarting vista Pin
Madan Chauhan17-Sep-08 19:00
Madan Chauhan17-Sep-08 19:00 
AnswerRe: run my exe after restarting vista Pin
C++myLife17-Sep-08 21:25
C++myLife17-Sep-08 21:25 
QuestionBase Convertion Pin
C-Los17-Sep-08 18:16
C-Los17-Sep-08 18:16 
AnswerRe: Base Convertion [modified] Pin
Rane17-Sep-08 18:43
Rane17-Sep-08 18:43 
AnswerRe: Base Convertion Pin
SandipG 17-Sep-08 20:44
SandipG 17-Sep-08 20:44 
AnswerRe: Base Convertion Pin
Hamid_RT17-Sep-08 21:32
Hamid_RT17-Sep-08 21:32 
Questionstorage templates Pin
steph517-Sep-08 13:27
steph517-Sep-08 13:27 
AnswerRe: storage templates Pin
enhzflep17-Sep-08 16:59
enhzflep17-Sep-08 16:59 
yeah, easy.
Make a linked list, then upon adding a new item it gets added as a new node on the tail end of the list.

A little something like this, though with UNICODE & c++ support. There's linked lists in the stl now, but linked lists are a good educational tool, imho - hence my recommendation to write some code that uses your own implementation of them at least once.

struct myListItem
{
        char *itemText;
        int origPos;
        myListItem *nextItem;
        myListItem *prevItem;
};

// *****No error checking*******
// ** no code provided for initialization of list **
// checks a linked list for the provided text. If found, pointer to that item is returned
// if not found, the text is added to the list and a pointer to the new list item is returned
myListItem *add(myListItem *linkedListHead, char *newText)
{
    myListItem *curItem;
    bool alreadyExists = false;
    int curItemNum = 0;

    curItem = linkedListHead;
    if (curItem != NULL)
    do
    {
        if (!strcmp(curItem->itemText, newText))
            return curItem;
        curItem = curItem->nextItem;
        curItemNum++;
    }while (curItem->nextItem != NULL);
    else return NULL;   // we were passed a NULL pointer instead of the head of a list. exit

    // create the new list item
    curItem->nextItem = (myListItem*) malloc(1*sizeof(myListItem));
    // set it's prevItem member to point to us ,so we can traverse the list forwards or backwards
    curItem->nextItem->prevItem = curItem;
    // keep track of where the item was added. This means we can sort the list and still unsort it later
    curItem->origPos = curItemNum;
    // move to the new item
    curItem = curItem->nextItem;
    // allocate memory for the text
    curItem->itemText = (char*) malloc(strlen(newText)+1);
    // copy the text
    strcpy(curItem->itemText, newText);
    // bugger off
    return curItem;
}

QuestionUsing Memory Validator tool under 64 Bit Windows. Pin
rajandpayal17-Sep-08 11:04
rajandpayal17-Sep-08 11:04 
QuestionSeeking in large files (pref. STL) Pin
Trollslayer17-Sep-08 7:16
mentorTrollslayer17-Sep-08 7:16 
AnswerRe: Seeking in large files (pref. STL) Pin
David Crow17-Sep-08 7:29
David Crow17-Sep-08 7:29 
GeneralRe: Seeking in large files (pref. STL) Pin
Trollslayer17-Sep-08 8:05
mentorTrollslayer17-Sep-08 8:05 
QuestionHow does my app know the recent files? Pin
frqftgbdafr17-Sep-08 6:33
frqftgbdafr17-Sep-08 6:33 
AnswerRe: How does my app know the recent files? Pin
David Crow17-Sep-08 6:50
David Crow17-Sep-08 6:50 
GeneralRe: How does my app know the recent files? Pin
frqftgbdafr17-Sep-08 9:07
frqftgbdafr17-Sep-08 9:07 
GeneralRe: How does my app know the recent files? Pin
Hamid_RT17-Sep-08 9:39
Hamid_RT17-Sep-08 9:39 
GeneralRe: How does my app know the recent files? Pin
David Crow17-Sep-08 9:59
David Crow17-Sep-08 9:59 
QuestionMoveFile Problem Pin
roguecode17-Sep-08 3:53
roguecode17-Sep-08 3:53 
QuestionRe: MoveFile Problem Pin
Michael Schubert17-Sep-08 4:30
Michael Schubert17-Sep-08 4:30 
AnswerRe: MoveFile Problem Pin
Cedric Moonen17-Sep-08 4:38
Cedric Moonen17-Sep-08 4:38 
AnswerRe: MoveFile Problem Pin
roguecode17-Sep-08 6:41
roguecode17-Sep-08 6:41 
GeneralRe: MoveFile Problem Pin
Cedric Moonen17-Sep-08 6:52
Cedric Moonen17-Sep-08 6:52 
QuestionRe: MoveFile Problem Pin
roguecode17-Sep-08 7:15
roguecode17-Sep-08 7:15 
AnswerRe: MoveFile Problem Pin
Rajesh R Subramanian17-Sep-08 20:13
professionalRajesh R Subramanian17-Sep-08 20:13 
AnswerRe: MoveFile Problem Pin
CPallini17-Sep-08 21:38
mveCPallini17-Sep-08 21:38 

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.