Solved

_itoa_s  equivalent in c#

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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

728 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