473,386 Members | 1,694 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,386 software developers and data experts.

int changing on its own... Too Large?

134 100+
in my script,
a person is to type in the number 9999999999
9999999999 is saved as file1 (works fine)
9999999999 is loaded as integer1
integer2 is set equal to integer1
integer2 is saved as file2

But,the thing is that file2 is "1410065407" when it should be "9999999999"

file1 is how i wanted it (9999999999)

is the number too big or somthing?
how would it fix it?

thanks for your help
Jul 15 '07 #1
6 5291
JosAH
11,448 Expert 8TB
in my script,
a person is to type in the number 9999999999
9999999999 is saved as file1 (works fine)
9999999999 is loaded as integer1
integer2 is set equal to integer1
integer2 is saved as file2

But,the thing is that file2 is "1410065407" when it should be "9999999999"

file1 is how i wanted it (9999999999)

is the number too big or somthing?
how would it fix it?

thanks for your help
On most systems an unsigned int can hold a number as large as 2^32-1.
9999999999 % 2^32 == 1410065407 so yes, your ten digit 9s number is
too large for an unsigned 32 bit integer. Try long long instead.

kind regards,

Jos
Jul 15 '07 #2
lumpybanana247
134 100+
neat, thank you very much- that explains a lot.
is the only differnece that instead of declaring it
int integer1;
i use
long long int integer1;
because i tried it and it didnt work


thank you!
Jul 15 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
neat, thank you very much- that explains a lot.
is the only differnece that instead of declaring it
int integer1;
i use
long long int integer1;
because i tried it and it didnt work
Did you do a sizeof(long long)?? You should get the size in bytes.

For 32-bit Windows a long long is 8 bytes, which should be large enough.
Jul 15 '07 #4
neat, thank you very much- that explains a lot.
is the only differnece that instead of declaring it
int integer1;
i use
long long int integer1;
because i tried it and it didnt work


thank you!
If I'm not mistaken you need to try:

long long integer1;

not long long int integer1;
Jul 15 '07 #5
weaknessforcats
9,208 Expert Mod 8TB
This code:
Expand|Select|Wrap|Line Numbers
  1. long long int integer1;
  2.  
is perfectly OK. C (and C++) both allow you to code:
Expand|Select|Wrap|Line Numbers
  1. long long int integer1;
  2. short int var;
  3. //or
  4. long long integer1;
  5. short var;
  6.  
Jul 15 '07 #6
lumpybanana247
134 100+
o, i get it.. THANKS
Jul 16 '07 #7

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

Similar topics

7
by: John J. Lee | last post by:
I'm trying to change a base class of a big class hierarchy. The hierarchy in question is 4DOM (from PyXML). 4DOM has an FtNode class that defines __getattr__ and __setattr__ that I need to...
7
by: Stefan Finzel | last post by:
Hi, is there a way to change the display property on Windows Mobile 2003 SE Mobile/Pocket Internet Explorer? See following example. Please note: visibilty property has the same problem. Is...
13
by: Peter | last post by:
Can anyone tell me how to change the data type of a field in a table created with a make table query? The field is a binary and must be changed to text. alternately does anyone know how to specify...
10
by: Marizel | last post by:
I'm not sure there's an easy solution to this, but thought I'd ask. I often find myself with a query which I'd like to reuse, but with a different datasource. These datasources generally have...
4
by: Good Man | last post by:
Hi there I have a database with about 20 or so tables, maybe a few thousand rows in each. I am starting to do more complex things with my insertions etc, and I want to start to use...
6
by: Matt | last post by:
I have a production database that I need to change the logging type from circular to archived so that I can do online backups. The database is not particularly large, but is used by many people. ...
1
by: Bala Nagarajan | last post by:
Hello, I am building a web service application in which i will have to implement logging based on user id. My question is where do i store the user ids? Since the nature of this problem is so...
1
by: Kasey | last post by:
How do you change the row height in a data grid - I do not want to increase the height by changing my font size. My product is a touch screen so I have to make the row height large enought for a...
2
by: kolt45 | last post by:
I need to change these three programs to use arrays and i am having a hard time is there anyone that is willing to help? /*homework7a *kolton harper *10-12-07 * *Purpose: */
1
Ajm113
by: Ajm113 | last post by:
I find it odd all my scripts doesn't change the logged in person's name on any other page, but my threads page. I have no idea why! I looked over the script and saw nothing changing the session...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.