Solved

_itoa_s  equivalent in c#

Posted on 2015-01-07
3
214 Views
Last Modified: 2015-01-07
Hi,
Could some one please let me know what is the  c# equal of  _itoa_s   ,
I am in the middle of converting some c++ codes in to c# but I don't understand the usage of   _itoa_s  


har fif_ret;
char buffer[50];
CString strPlace;
strPlace = "2";
place = atoi(strPlace.GetBuffer(0));
_itoa_s(fif_ret, buffer, 2);

also  what would be the output of   fif_ret  ?
0
Comment
Question by:kavithma
[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 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 40535273
_itoa_s  is integer to a string ...
so, basically, you use

int yourint = 123:
string yourstring = yourint.ToString();

that's it, in short.
for special needs (formatting of the thousand separator, or comma for decimals), you can use the 2nd optional argument of the ToString() function, which either allows to specify a formatting string or a FormatProvider
http://msdn.microsoft.com/en-us/library/6t7dwaa5%28v=vs.110%29.aspx
0
 

Author Comment

by:kavithma
ID: 40535279
Hi thanks for the quick reply,
what is the use of  _last parameter of  2 as per my code above in _itoa_s     ?  

thanks
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 40535286
>>but I don't understand the usage of   _itoa_s

As a general point you should look it up in the help files.  Just converting something you don't understand means: I guess it is this so I'll put this in place and hope, if it doesn't work correctly afterwards then it isn't my problem.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

631 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