Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Convert string to integer problem!

Posted on 1999-07-15
1
Medium Priority
?
179 Views
Last Modified: 2010-04-16
I want nCycle to get the value 24 like szBufCYCLE has. What have I done wrong?

char szBufCYCLE[10];
int nCycle;
GetPrivateProfileString("GENERAL", "CYCLE", "StringNotFound",szBufCYCLE, sizeof(szBufCYCLE)-1, lpszFileName);
MessageBox(szBufCYCLE, "Cycle", MB_OK); //Shows 24
nCycle = (int) szBufCYCLE;
char T[10];
MessageBox(itoa(nCycle, T, 10), "n", MB_OK);
//Shows 1324975 (something that is not 24)

Thanks!
0
Comment
Question by:bert1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
bluemask earned 40 total points
ID: 1200349

nCycle = atoi(szBufCYCLE);
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question