Solved

_itoa_s  equivalent in c#

Posted on 2015-01-07
3
141 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
3 Comments
 
LVL 142

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now