Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

atoi problem 1

Status
Not open for further replies.
Nov 29, 2001
72
US
Guys,
I'm an old Visual C++ developer who hasn't use it for about 6 years. I am not using C#.net and I have a need to convert a string to int. In C++ it was easy to just atoi.

When I try to use atoi in C#.net I get the old familiar "not in namespace" error. Here's the piece of code:

tempTimeText = tempDataRow["Hours"].ToString();
hours = atoi(tempTimeText);

Am I losing it or do I need to add some "using" statement or reference. Is my syntax completely wrong? The MSDN and TechNet is as helpful as a pay toilet in a poop ward as usual.

Thanks in advance for you help,
Dave

 
Use:

Convert.ToInt32( myString );

or if your DataRow holds the value as an int already you can use C++ style casting:

int hours = (int)tempDataRow["Hours"];
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top