Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

How to convert string to integer

This is a discussion on How to convert string to integer within the C and C++ forums, part of the Software Development category; While passing integer value as command line arguments to main method it reads it as character then how to convert it to integer again For example, Consider the following program ...

Go Back   Geeks Talk > Software Development > C and C++
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 07-09-2009
Junior Member
 
Join Date: Jun 2009
Location: Andhra Pradesh, India
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Shravan Mahendra is on a distinguished road
How to convert string to integer

While passing integer value as command line arguments to main method
it reads it as character then how to convert it to integer again
For example,
Consider the following program
void main(int argc, char* argv[])
while passing the argument it will store in argv[0]
then how to get it as integer value
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-10-2009
Contributing Member
 
Join Date: Jun 2009
Location: United States
Posts: 71
Thanks: 0
Thanked 5 Times in 4 Posts
CSOOR is on a distinguished road
Re: How to convert string to integer

#include <stdlib.h>

Try atoi function
Reply With Quote
  #3 (permalink)  
Old 09-26-2009
Junior Member
 
Join Date: Sep 2009
Location: Chennai
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
munish.forum is on a distinguished road
Re: How to convert string to integer

To convert a integer from string, you can use atoi function.

while passing a arguments from command lines, data will be converted to the corresponding data type.
Reply With Quote
Reply

  Geeks Talk > Software Development > C and C++

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Smallest Integer rijus Mathematical Puzzles 2 06-25-2009 01:33 PM
convert string into float val using php not javascript Niyati_1984 PHP 1 04-27-2009 11:24 AM
what function is useful to convert string to number learqtptesting QTP 1 08-20-2008 02:01 AM
Difference between String.Convert Vs String.ToString jbanx C# 6 03-24-2008 01:02 PM
How to convert the String to date in Parallel jagadish10 Data Warehousing 0 06-19-2007 05:19 AM


All times are GMT -4. The time now is 03:21 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved