[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

simple data type conversion

Posted on 1998-08-31
7
Medium Priority
?
181 Views
Last Modified: 2010-04-10
I have an int or a long whose value I want to check via a messagebox, but I need to convert it into a data type that the messagebox will display. How is it converted?
0
Comment
Question by:jtm082698
[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
  • 3
  • 3
7 Comments
 
LVL 2

Expert Comment

by:kellyjj
ID: 1171707
you could type cast it.

int x=65;
char a;

a= (char ) x;
0
 

Accepted Solution

by:
billcav earned 80 total points
ID: 1171708
Look in your help for itoa() or ltoa(), which convert intTOascii and longTOascii respectively.

0
 
LVL 22

Expert Comment

by:nietod
ID: 1171709
itoa() etc are microsoft specifc functions.  If you want to use a more portable function (of course you are working in windows so portability is not a big issue) you can use sprintf()  That is a standard function that is available in all C++ implimentations.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:billcav
ID: 1171710
When did Xtoa() become Microsoft-specific? I've used them in *NIX programs for more than half a decade. They reside in stdlib.


0
 
LVL 22

Expert Comment

by:nietod
ID: 1171711
microsoft specific might have been pushig it a little.  They are not part of the C++ standard so some implimentations will not support them.  But obviously some do other than microsoft.
0
 

Expert Comment

by:billcav
ID: 1171712
Didn't they become part of the ANSII C standard four or five years back? I think the official implementation was as macros. IIRC, the C++ proposed standard has been built on the C standard, so it should include the xtoa() and atox() functions/macros.

BTW, the reason to use them instead of sprintf() is probably moot. With the current state of optimizers and the current speed of processors and size of hard drives and memory the TINY performance/code size benefit is probably not worth thinking about.


0
 
LVL 22

Expert Comment

by:nietod
ID: 1171713
According to the Microsoft docs they are not standard and it is a well know fact that Microsoft is never wrong.  : - )  The argument is moot from both sides, since this is a windows application, portability can't be that big an issue anyways.
0

Featured Post

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

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…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

656 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