Home Posts Topics Members FAQ
Betaver
I just want to output a long long or int64 variable use printf
function.But if I use printf("%ld",x) ; I can't output an x more than
long.
I can only output it like this:
long long a,b,c;
a=c/100000000;
printf("%ld",a) ;
b=c%100000000;
printf("%08ld\n ",b);
How can I output it in an regular way?
Nov 15 '05
Subscribe Reply
26 104452
- <
- 1
- 2
- 3
Richard Bos
"Betaver" <Be*****@gmail. com> wrote:
Thanks for all the excellent answers.
My complier is gcc 3.4.2 and can't use another one, so I decide output
like this:
printf("%I64d", c);
Is it all right?
Not in C, it isn't. Maybe in Ganuck, but that's off-topic here; ask in
gnu.gcc.help (If I've remembered the name correctly; readily findable,
anyway).
Richard
Nov 15 '05 #21
Default User
Betaver wrote:
To Jordan Abel:
It's my mistake.I may wrote "__int64", not "int64"
Looks like you are trying quote messages using Google.
I think you will find the information below of value
Brian
--
Please quote enough of the previous message for context. To do so from
Google, click "show options" and use the Reply shown in the expanded
header.
Nov 15 '05 #22
Joe Wright
Betaver wrote:
Thanks for all the excellent answers.
My complier is gcc 3.4.2 and can't use another one, so I decide output
like this:
printf("%I64d", c);
Is it all right?
Have you tried..
#include <stdio.h>
long long a;
int main(void)
{
a = 999999999;
a *= 5;
printf("%lld\n" , a);
return 0;
}
...a real C program?
With GCC 3.1 (DJGPP) this prints..
4999999995
--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Nov 15 '05 #23
Betaver
Joe Wright wrote: With GCC 3.1 (DJGPP) this prints..
4999999995
Maybe the problem is my header file. But "%lld" isn't supported here.
Certainly "%I64d" works well.
Nov 15 '05 #24
Betaver
>Joe Wright wrote:
With GCC 3.1 (DJGPP) this prints..
4999999995
With Dev-C++ 4.9.9.2 Gcc 3.4.2
Nov 15 '05 #25
jacob navia
Betaver wrote:
Joe Wright wrote:
With GCC 3.1 (DJGPP) this prints..
4999999995
With Dev-C++ 4.9.9.2 Gcc 3.4.2
The printf you are calling is Microsoft printf in CRTDLL.DLL
Apparently you are using the mingw version of gcc without glibc.
Use I64 in that system since it works.
Nov 15 '05 #26
jacob navia
Keith Thompson wrote:
Zara <yo****@terra.e s> writes:On 11 Nov 2005 00:05:23 -0800, "Be*****@gmail. com" <Be*****@gmail. com>
wrote:Zara:
I use Dev-C++ 4.9.9.2, Gcc 3.4.2#include <stdio.h>
long long a;
int main()
{
a=99999999 9;
a*=5;
printf("%lld ",a);
}It outputs 705032699, why?
Just tried it. In GCC 3.4.2 the long long type hast 8 bytes, as
required by the standard, but it seems printf is not updated or is
broken when working with long long.I don´t know if it works in later versions.
<SEMI-OT>
printf is part of the runtime library; it's not part of gcc.
</SEMI-OT>
Under windows they are using crtdll.dll by Microsoft.
Nov 15 '05 #27
- <
- 1
- 2
- 3
This thread has been closed and replies have been disabled. Please start a new discussion.
Similar topics
88 6032 Is it standard and practical to use long long types? by: Matt |last post by: Hi folks. Can you help with some questions? I gather that some types supported by g++ are nonstandard but have been proposed as standards. Are the long long and unsigned long long types still under consideration for the ANSI C and C++ standards? Are they likely to be accepted into the standards? Which compilers support those types, and which do not? C / C++ |
5 23105 Printing "long double" type via printf() on MinGW g++ 3.2.3 by: Piotr B. |last post by: Hello, I use MingGW g++ 3.2.3 on Windows 2000/AMD Athlon XP. I tried to output a "long double" variable using stdio printf(). I've tried various %formats (%llf, %Lf etc.), but none of them worked... The same source compiled with Borland C++Builder 5.0 works for %Lf format. How to get the same results with MinGW g++ ? C / C++ |
1 6910 Assigning unsigned long to unsigned long long by: George Marsaglia |last post by: The essence of a multiply-with-carry RNG is to have declarations in the RNG proc, such as unsigned long mwc( ){ static unsigned long x = 123456789, c = 362436; unsigned long long t, a = 916905990LL; \* then reatedly form the 64-bit t = a*x+c, after which the new carry c is the top 32, and the new x (output), is the bottom 32 bits of t: C / C++ |
7 5699 unsigned long long overflow? by: dmpk2k |last post by: Forgive me if this is obvious to you. I feel somewhat foolish. I've scribbled together something that demonstrates my problem. It takes the product of all integers n squared, where n is 1..10. ----------------- int main() { int i; unsigned long long product = 1; C / C++ |
3 4034 unions with long long ints and doubles? by: Chris N. Hinds |last post by: I have a question regarding accessing long long ints in unions. I have constructed a union with a double, two ints in a structure, and a long long int. When the double is loaded with a floating-point constant, the double is loaded correctly, and the two ints in the structure reflect the double correctly when printed as hex values. However, when the long long is printed as a hex value (using %016x) it prints 8 zeros then the upper 32-bits... C / C++ |
36 5322 extracting front bits from an unsigned long long? by: Digital Puer |last post by: Hi, suppose I have an unsigned long long. I would like to extract the front 'n' bits of this value and convert them into an integer. For example, if I extract the first 3 bits, I would get an int between 0 and 7 (=2^3-1). Could someone please help out? I can assume the largest returned value fits in an int. Also, I'm on a big-endian PPC (AIX), in case that matters. Ideally, I'd like to implement a prototype like: int... C / C++ |
4 13357 format specifier for long long ints.... by: Ray Dillinger |last post by: Hi. I'm using GCC on a SuSE Linux distribution, and the following program doesn't work the way I expect. I'm using the conversion specifier for long long integers that's in the man pages, but what's coming out is interpreting the lowest few bytes of the long long int as an ordinary integer. Other tests reveal that the full width is being preserved and used in calculations - it's just output that seems broken. I must have some... C / C++ |
12 9527 Oracle Pro-C supports long long data type? 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 use "long long" integer type(64 bit), but it seems that Oracle doesn't like it after execution, and giving me error code -1460, any idea about this? thx C / C++ |
17 7566 Unsigned Long Long Overflow by: Tarique |last post by: This program was compiled on MS Visual C++ 08 /*Fibonacci Numbers*/ #include<stdio.h> #include<limits.h> void fibonacci(int n) { unsigned long long fib0 = 0;/*First Fibonacci Number*/ C / C++ |
9666
What is ONU? 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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of... General |
10199
Maximizing Business Potential: The Nexus of Website Design and Digital Marketing 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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is... Online Marketing |
1 10139 The easy way to turn off automatic updates for Windows 10/11 by: Hystou |last post by: Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,... Windows Server |
9020
AI Job Threat for Devs by: agi2029 |last post by: Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea... Career Advice |
6769 Couldnt get equations in html when convert word .docx file to html file in C#. by: conductexam |last post by: I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();... C# / C Sharp |
5417 Trying to create a lan-to-lan vpn between two differents networks by: TSSRALBI |last post by: Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls... Networking - Hardware / Configuration |
5551 Windows Forms - .Net 8.0 by: adsilva |last post by: A Windows Forms form does not have the event Unload, like VB6. What one acts like? Visual Basic .NET |
2 3700
How to add payments to a PHP MySQL app. by: muto222 |last post by: How can i add a mobile payment intergratation into php mysql website. PHP |
3 2909
Comprehensive Guide to Website Development in Toronto: Expert Insights from BSMN Consultancy by: bsmnconsultancy |last post by: In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive... General |
By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.
To disable or enable advertisem*nts and analytics tracking please visit the page.