Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!ut-sally!husc6!cmcl2!brl-adm!adm!Alan_Cote.DlosLV-Comm@Xerox.COM From: Alan_Cote.DlosLV-Comm@Xerox.COM Newsgroups: comp.lang.c Subject: Re: Big numbers in C? Message-ID: <8529@brl-adm.ARPA> Date: Tue, 28-Jul-87 13:56:26 EDT Article-I.D.: brl-adm.8529 Posted: Tue Jul 28 13:56:26 1987 Date-Received: Thu, 30-Jul-87 00:49:23 EDT Sender: news@brl-adm.ARPA Lines: 44 Robert Lordwrites: >I was wondering....How do I use large numbers (over 32000) in C? I know about >float type, but that give it in wierd numbers. I need numbers in the hundreds of millions, and I need them in real format. (i.e. 100000000), not float >format. If there a little script that could change float to real? If, by "real", you mean "integer", then try the "long" type. That will give you a 32-bit, signed number. >Also, I am having a little trouble with this statement: > >strtol(data.number); > >Where: data.number[1] == 5 > data.number[2] == 7 /*Or whatever...Just examples*/ > data.number[3] == \0 > >Is there a way to convert this string to an numerical value? The reason I >have to have it like this is because I need to only allow 8 characters of >input. > > Thanks in advance, > Robert Lord > ..!ihnp4!killer!robertl If this read a little differently, for example: data.number[1] == '5' data.number[2] == '7' /*Or whatever...Just examples*/ data.number[3] == '\0' then strtol(data.number) should return a long value (assuming, of course, that you have declared strtol() to return (long) :=). If that doesn't work, try using sscanf(). - Al Cote' "Mine is the last voice you will ever hear... Don't be alarmed" - F. Sinatra