Solved

_itoa_s  equivalent in c#

Posted on 2015-01-07
3
157 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

896 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

11 Experts available now in Live!

Get 1:1 Help Now