Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

_itoa_s  equivalent in c#

Posted on 2015-01-07
3
Medium Priority
?
234 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 1500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

721 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