473,387 Members | 1,464 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.

convert a string to long long

hello,
I want to convert str to long long

say str = "9986456734" // mobile number and store in variable,
i uaed
Expand|Select|Wrap|Line Numbers
  1.    long long ll;
  2.    ll = atoll(str);
  3.    printf("%ll", ll);
i am getting some undesred result.
its 1397741042.
how do i get desired output which is 9986456734
May 18 '07 #1
5 7303
Ganon11
3,652 Expert 2GB
Could there be a problem caused by not including a '\0' at the end of str?
May 18 '07 #2
Silent1Mezzo
208 100+
code removed as per posting guidelines

My results:
Expand|Select|Wrap|Line Numbers
  1. %9986456734
  2. Process returned 11
This was using Pelles C in Windows (@ work thats why it's Pelles :P )
May 18 '07 #3
AdrianH
1,251 Expert 1GB
Can you post the code fragment that shows what you are doing? Include all portions that are dependent/relevent.


Adrian
May 18 '07 #4
Silent1Mezzo
208 100+
code removed as per posting guidelines

My results:
Expand|Select|Wrap|Line Numbers
  1. %9986456734
  2. Process returned 11
This was using Pelles C in Windows (@ work thats why it's Pelles :P )

Umm...My code was exactly the same as the user first posted....I just posted it to show that the code he had worked properly.
May 18 '07 #5
AdrianH
1,251 Expert 1GB
Umm...My code was exactly the same as the user first posted....I just posted it to show that the code he had worked properly.
It was close (you had the same three line that were posted), but there was a lot missing in the OP code so it is hard to say.


Adrian
May 18 '07 #6

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

Similar topics

1
by: Edward Arthur | last post by:
Hi, I'm trying to convert a string to an unsigned long long int. % /tmp/long str 0x20000 base 16 decimal 131072 hex 20000 str 0x1abcd8765
1
by: wesbird | last post by:
Hi, I am new here. Please forgive me if I ask some question already got answered. I do search forum first but I did not find the answer. here is my question, in VB you can convert a string to long...
19
by: John | last post by:
Hi How can I convert a string to long value? Most objects have a toString method but strings don't have a toLong method. Thanks Regards
5
by: XML newbie: Urgent pls help! | last post by:
function to convert string to 1 dimensional array of long in VB.Net
3
by: XML newbie: Urgent pls help! | last post by:
Does anyone have a snippet of code that will convert a string array to a long array? I've nearly smashed my head against the wall trying to figure this out. I'm Using vb.net 2005 Pls reply...
7
by: wenmang | last post by:
what is format for sprintf to convert long long integer (64 bits) to string?
12
by: wenmang | last post by:
Hi, I am using following Oracle Proc-C compiler: Pro*C/C++: Release 8.1.7.0.0 - Production on Thu Jun 15 15:57:32 2006 (c) Copyright 2000 Oracle Corporation. All rights reserved. I like to...
15
by: shiniskumar | last post by:
How to convert string to double? Ive got a double variable dTot; its value is 5.037717235E7 when i did FreemarkerTools.formatDecimal(dTot) i got it as string "50377172.35". now i want to...
1
by: maximus tee | last post by:
hi, is there a way to convert from string to long? for eg: i want to concatenate all the arrays into data and make it same type (long) as data1. a='0x' array0 =...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.