473,387 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Command Line Arguments

Dear Forum

Hai every one

I want to give input at the command line as mul 4 5
The program mul should caluculate 4*5 , but the input is taken at command prompt.
Since the input is considered as string , how do i convert (strings ) 4,5 to integer to caluculate 4*5.
Please help me
With regards
KIRAN SREE(<e-mail address removed - weaknessforcats>)
Dec 26 '07 #1
3 1704
scruggsy
147 100+
Dear Forum

Hai every one

I want to give input at the command line as mul 4 5
The program mul should caluculate 4*5 , but the input is taken at command prompt.
Since the input is considered as string , how do i convert (strings ) 4,5 to integer to caluculate 4*5.
Please help me
With regards
KIRAN SREE(<>)
You can write your own function to do it pretty easily, or use the non-standard function atoi() which is most likely included in your environment.
Dec 26 '07 #2
gpraghuram
1,275 Expert 1GB
Dear Forum

Hai every one

I want to give input at the command line as mul 4 5
The program mul should caluculate 4*5 , but the input is taken at command prompt.
Since the input is considered as string , how do i convert (strings ) 4,5 to integer to caluculate 4*5.
Please help me
With regards
KIRAN SREE(<>)

As suggested you can use atoi.
it will be atoi(argv[1]) will return you the integer value.

Note:
Please dont your personal ID's in the forum

Raghuram
Dec 26 '07 #3
hi!
either u can you use atoi(argv[1]), or you can use sprintf or sscanf.

with regards,
G.Siva Prakash Reddy.
Dec 26 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Hari | last post by:
can i have command line arguments in VS.NET applicatio? if yes how? Can i have some code snippets of the above functionality? I know we can acjieve this in console application form command...
6
by: Jon Hewer | last post by:
hi i am writing a little script and currently implementing command line arguments following the guide by mark pilgrim from dive into python; ...
7
by: Steve M | last post by:
I'm trying to invoke a Java command-line program from my Python program on Windows XP. I cannot get the paths in one of the arguments to work right. The instructions for the program describe the...
2
by: SunRise | last post by:
Hi I am creating a C Program , to extract only-Printable-characters from a file ( any type of file) and display them. OS: Windows-XP Ple help me to fix the Errors & Warnings and explain...
1
by: amirmira | last post by:
I would like to set command line arguments to a service at install time. I need to do this because I need to get information from different registry locations depending on my command line argument....
1
by: Rune Jacobsen | last post by:
Hi, I've been trying to figure this one out, but my experience just doesn't have what it takes... :| I am writing an application that reads an XML file and displays the contents in various...
4
by: Roland | last post by:
Hi, I am developing a C++ project and want to pass some command line arguments in VS .NET 2003. I am in debug mode, the configuration is set to Debug and I entered my argument list in Project ->...
40
by: raphfrk | last post by:
I have a program which reads in 3 filenames from the command line prog filename1 filename2 filename3 However, it doesn't work when one of the filenames has spaces in it (due to a directory...
2
by: Milan | last post by:
Hi, Please guide me how to set command line argument and how to retrive command line argument. Senario: vb.net application should be able to execute from command prompt by passing login and...
7
by: Jwe | last post by:
Hi, I've written a program which has both a command line interface and Windows form interface, however it isn't quite working correctly. When run from command line with no arguments it should...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.