Click here to Skip to main content
15,895,606 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to get all desktop icons? Pin
ioat25-Dec-03 19:16
ioat25-Dec-03 19:16 
GeneralRegarding drw_dxf.h Pin
cithu25-Dec-03 18:22
cithu25-Dec-03 18:22 
Questionhow to write and save ini files like some apps do with their ini's Pin
ELY M.25-Dec-03 18:04
ELY M.25-Dec-03 18:04 
AnswerRe: how to write and save ini files like some apps do with their ini's Pin
Michael Dunn25-Dec-03 19:12
sitebuilderMichael Dunn25-Dec-03 19:12 
GeneralRe: how to write and save ini files like some apps do with their ini's Pin
ELY M.25-Dec-03 21:24
ELY M.25-Dec-03 21:24 
GeneralRe: how to write and save ini files like some apps do with their ini's Pin
shultas26-Dec-03 4:27
shultas26-Dec-03 4:27 
AnswerRe: how to write and save ini files like some apps do with their ini's Pin
ELY M.26-Dec-03 12:49
ELY M.26-Dec-03 12:49 
GeneralRe: how to write and save ini files like some apps do with their ini's Pin
shultas26-Dec-03 14:01
shultas26-Dec-03 14:01 
Okie. I had a look and I see the problem. First off, what exactly is it that you are trying to do with your program? Then I can be direct and show you the code necessary.
For now, I'll show you what is wrong with the loop.

Here's your code:

int m_ncount = 1;
CString KeyName;
for(int x=0; x < m_ncount; ++x)
{
KeyName.Format("n%ld", x);
///WritePrivateProfileString("TEST", buffer, putstring, sIniFile);
WritePrivateProfileString("TEST", KeyName, putstring, sIniFile);
m_ncount++;

}

If you look carefully, you will see the reason your program locks up is because you have created an infinate loop! The condition "x < m_ncount" will never be true, because you are incrementing the m_ncount variable at the end of the loop! So, the first time that the loop runs,
m_ncount=1 and x=0. The second pass, m_ncount=2; x=1 ... Third pass, m_ncount=3;x=2. So each pass, the variable x gets incremented and so does the variable m_ncount! So therefore the loop will run forever!

Post back and let me know what you are trying to do and I'll throw something together for you real fast to take example of!

Shultas
GeneralRe: how to write and save ini files like some apps do with their ini's Pin
ELY M.26-Dec-03 14:44
ELY M.26-Dec-03 14:44 
GeneralRe: how to write and save ini files like some apps do with their ini's Pin
shultas26-Dec-03 16:10
shultas26-Dec-03 16:10 
GeneralRe: how to write and save ini files like some apps do with their ini's Pin
ELY M.26-Dec-03 18:42
ELY M.26-Dec-03 18:42 
AnswerRe: how to write and save ini files like some apps do with their ini's Pin
ELY M.26-Dec-03 16:01
ELY M.26-Dec-03 16:01 
GeneralRe: how to write and save ini files like some apps do with their ini's Pin
shultas26-Dec-03 17:03
shultas26-Dec-03 17:03 
GeneralRe: how to write and save ini files like some apps do with their ini's Pin
ELY M.27-Dec-03 5:22
ELY M.27-Dec-03 5:22 
GeneralRe: how to write and save ini files like some apps do with their ini's Pin
shultas28-Dec-03 10:08
shultas28-Dec-03 10:08 
GeneralRe: how to write and save ini files like some apps do with their ini's Pin
ELY M.29-Dec-03 5:01
ELY M.29-Dec-03 5:01 
GeneralRe: how to write and save ini files like some apps do with their ini's Pin
ELY M.29-Dec-03 5:20
ELY M.29-Dec-03 5:20 
GeneralRe: how to write and save ini files like some apps do with their ini's Pin
ELY M.29-Dec-03 6:34
ELY M.29-Dec-03 6:34 
GeneralPostMessage Problem Pin
percyvimal25-Dec-03 18:00
percyvimal25-Dec-03 18:00 
GeneralRe: PostMessage Problem Pin
Monty225-Dec-03 20:39
Monty225-Dec-03 20:39 
GeneralCSingleLock Pin
Anonymous25-Dec-03 17:10
Anonymous25-Dec-03 17:10 
GeneralRe: CSingleLock Pin
Michael Dunn25-Dec-03 19:15
sitebuilderMichael Dunn25-Dec-03 19:15 
GeneralRe: CSingleLock Pin
Anonymous25-Dec-03 20:30
Anonymous25-Dec-03 20:30 
Questiondifference between ATL, MFC, and .NET Common Class? Pin
torrentmoon25-Dec-03 14:45
torrentmoon25-Dec-03 14:45 
AnswerRe: difference between ATL, MFC, and .NET Common Class? Pin
peterchen25-Dec-03 23:38
peterchen25-Dec-03 23: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.