Click here to Skip to main content
15,902,938 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: problem on resize window???? Pin
see me2-Jul-06 23:19
see me2-Jul-06 23:19 
AnswerRe: problem on resize window???? Pin
mimimimilaw2-Jul-06 23:29
mimimimilaw2-Jul-06 23:29 
GeneralRe: problem on resize window???? Pin
see me2-Jul-06 23:35
see me2-Jul-06 23:35 
QuestionHow to validate data in property sheet. Pin
jadhav1232-Jul-06 22:53
jadhav1232-Jul-06 22:53 
AnswerRe: How to validate data in property sheet. Pin
Viorel.2-Jul-06 23:15
Viorel.2-Jul-06 23:15 
GeneralRe: How to validate data in property sheet. Pin
jadhav1236-Jul-06 23:25
jadhav1236-Jul-06 23:25 
AnswerRe: How to validate data in property sheet. Pin
Rudolf Jan3-Jul-06 0:55
Rudolf Jan3-Jul-06 0:55 
QuestionVector Problem [modified] Pin
CornToeGoblin2-Jul-06 22:51
CornToeGoblin2-Jul-06 22:51 
What i am trying to do is make a console program that gets playlist info from winamp and stores 2 things, the track number and the corresponding track name and stores it into a vector that is a struct with and int and a char defined like this:

struct sIPlaylist
{
char *Name;
int Position;
};
vector <siplaylist> dPlaylist;

The problem that i am having is that after i do a loop and go through the entire playlist and store both values for each song when i try to recall it like this:

Console::WriteLine(dPlaylist.at(a).Name);

no matter what number i put at a the text is always the last song name in the playlist escentially all of the Name part of the vector are the same text. this is how the loop is defined:

void CWinamp::gEntirePlaylist()
{
sIPlaylist tmp; // i think this might be where my problem is but im reseting the values at the beginning of each loop
for(int i=0; i < wInfo.pTotal ; i++) // run the loop until the end of the playlist
{
tmp.Name="";
tmp.Position=i+1;
tmp.Name=gTrackName(i); // gTrackName returns a char * with the song name of playlist track number i
dPlaylist.push_back(tmp); // move the lastest info to the bottom of the vector
}
Console::WriteLine(dPlaylist.size());
Console::Write(dPlaylist.at(222).Position); // this works perfectly
Console::Write(". ");
Console::WriteLine(dPlaylist.at(222).Name);
}

This is the console output:

222. Benny Bennassi .... Whos your daddy

that song isnt actually number 222 but actually number 3111 which is the last song in the playlist.

Im not sure what im missing but i obviously have some part of my code wrong and i would really appreciate any help.

- Corntoe

-- modified at 4:53 Monday 3rd July, 2006
QuestionRe: Vector Problem Pin
Sarath C2-Jul-06 22:58
Sarath C2-Jul-06 22:58 
AnswerRe: Vector Problem Pin
Cedric Moonen2-Jul-06 22:59
Cedric Moonen2-Jul-06 22:59 
AnswerRe: Vector Problem Pin
Viorel.2-Jul-06 23:06
Viorel.2-Jul-06 23:06 
GeneralRe: Vector Problem Pin
CornToeGoblin3-Jul-06 8:10
CornToeGoblin3-Jul-06 8:10 
Questionregarding popup menus for ListBox. Pin
happy_ram2-Jul-06 22:34
happy_ram2-Jul-06 22:34 
AnswerRe: regarding popup menus for ListBox. Pin
Hamid_RT2-Jul-06 22:42
Hamid_RT2-Jul-06 22:42 
AnswerRe: regarding popup menus for ListBox. Pin
Sarath C2-Jul-06 22:45
Sarath C2-Jul-06 22:45 
AnswerRe: regarding popup menus for ListBox. Pin
Viorel.2-Jul-06 22:53
Viorel.2-Jul-06 22:53 
QuestionHow to call Stored procedure in VC++ Pin
maharaja pandian2-Jul-06 22:13
maharaja pandian2-Jul-06 22:13 
AnswerRe: How to call Stored procedure in VC++ Pin
Hamid_RT2-Jul-06 22:53
Hamid_RT2-Jul-06 22:53 
AnswerRe: How to call Stored procedure in VC++ Pin
Sarath C2-Jul-06 22:55
Sarath C2-Jul-06 22:55 
Questionset cursor position in table in rich edit Pin
Chetan Sheladiya2-Jul-06 22:12
professionalChetan Sheladiya2-Jul-06 22:12 
AnswerRe: set cursor position in table in rich edit Pin
see me2-Jul-06 22:22
see me2-Jul-06 22:22 
Questionwhy bitmap save complete and not load complete Pin
Chetan Sheladiya2-Jul-06 22:08
professionalChetan Sheladiya2-Jul-06 22:08 
QuestionHow to call Stored procedure in VC++ Pin
maharaja pandian2-Jul-06 22:06
maharaja pandian2-Jul-06 22:06 
Questionsdi Pin
ashish dogra2-Jul-06 21:59
ashish dogra2-Jul-06 21:59 
AnswerRe: sdi Pin
Weiye Chen2-Jul-06 22:02
Weiye Chen2-Jul-06 22:02 

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.