delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/26/17:20:31

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: argv[], char, and int
Date: Sat, 26 Apr 1997 13:15:14 -0700
Organization: Alcyone Systems
Lines: 23
Message-ID: <33626252.519EA2AA@alcyone.com>
References: <5jtgo3$74r$1 AT excalibur DOT flash DOT net>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Ryan Crumley wrote:

> I am realitivly new to C/C++ and have a few questions. I am hoping
> someone
> can give me some guidance. This is a simplified version of what I am
> trying
> to do but hopefully it will get the point across. What I would like to do
> is take argv[1], and argv[2] and preform math operations on them. This
> brings up a problem because I am using "char *argv" How would I go about
> changing these to an int? If anyone would be willing to help me could you
> email me at the address below.

You need the routines to change strings into numbers.  Look into the
stdlib.h routines atof, atoi, or atol.  For more power, you can use strtol
or strtoul.

-- 
       Erik Max Francis, &tSftDotIotE / email / max AT alcyone DOT com
                     Alcyone Systems /   web / http://www.alcyone.com/max/
San Jose, California, United States /  icbm / 37 20 07 N  121 53 38 W
                                   \
                      "The future / is right there."
                                 / Bill Moyers

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019