Which format I have to use in scanf,
to format a long long int (64bits int
__int64 in MS VC++).
Thanks in advance 12 20312
__frank__ <no***********@ indirizzo.non.v alido> writes: Which format I have to use in scanf, to format a long long int (64bits int __int64 in MS VC++).
"%lld", if your library supports it. It's required by C99, but of
course there was long long type in C90.
--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
__frank__ wrote: Which format I have to use in scanf, to format a long long int (64bits int __int64 in MS VC++). Thanks in advance
"%lld" or "%lli".
Note: The long long integer types are in the language since C99;
AFAIK, MS VC will not fully support C99 even in their 2005 Studio.
At least in VC++6, the semantics of the 64 bit types were partially
broken.
If the above format does not work, you have a 64 bit type as an
implementation specific extension; the format should be specified
in the online help. Otherwise, you may have to ask in a newsgroup
or forum where your implementation is topical.
BTW: If you try to keep your code conforming, you can #define
the appropriate integer conversion format strings and work with
them like that:
#if (defined __STDC_VERSION_ _) && __STDC_VERSION_ _ >= 199901L
# define MY_SLLFORMAT "%lld"
# define MY_ULLFORMAT "%llu"
#elif ...... /* ask for your implementation */
...../* Define your implementation specific MY_SLLFORMAT etc here */
#else
# error Cannot define an appropriate 64 bit integer format
#end
.....
printf("Tit (" MY_SLLFORMAT ") for tat\n", mylonglongvar);
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Keith Thompson wrote: __frank__ <no***********@ indirizzo.non.v alido> writes:
Which format I have to use in scanf, to format a long long int (64bits int __int64 in MS VC++).
"%lld", if your library supports it. It's required by C99, but of course there was long long type in C90.
^
no
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Michael Mair <Mi**********@i nvalid.invalid> writes: Keith Thompson wrote: __frank__ <no***********@ indirizzo.non.v alido> writes:
Which format I have to use in scanf, to format a long long int (64bits int __int64 in MS VC++). "%lld", if your library supports it. It's required by C99, but of course there was long long type in C90. ^ no
Whoops! Thanks.
--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
On 2005-10-29, Michael Mair <Mi**********@i nvalid.invalid> wrote: __frank__ wrote: Which format I have to use in scanf, to format a long long int (64bits int __int64 in MS VC++). Thanks in advance
"%lld" or "%lli".
Note: The long long integer types are in the language since C99; AFAIK, MS VC will not fully support C99 even in their 2005 Studio. At least in VC++6, the semantics of the 64 bit types were partially broken. If the above format does not work, you have a 64 bit type as an implementation specific extension; the format should be specified in the online help. Otherwise, you may have to ask in a newsgroup or forum where your implementation is topical.
BTW: If you try to keep your code conforming, you can #define the appropriate integer conversion format strings and work with them like that:
#if (defined __STDC_VERSION_ _) && __STDC_VERSION_ _ >= 199901L # define MY_SLLFORMAT "%lld" # define MY_ULLFORMAT "%llu" #elif ...... /* ask for your implementation */ ..../* Define your implementation specific MY_SLLFORMAT etc here */ #else # error Cannot define an appropriate 64 bit integer format #end
.... printf("Tit (" MY_SLLFORMAT ") for tat\n", mylonglongvar);
Cheers Michael
Usually when defining a macro for a format specifier you don't want
to include the % sign, so as to allow the user to include field
widths and so on
for example
#define PRIdLLONG "lld"
#define PRIuLLONG "llu"
printf("Here's an example with a field width: %10"PRIdLLONG"\ n", var);
[i don't know if the entire PRI*/SCN* set of identifiers are
reserved if inttypes.h is included - however if his system has
inttypes.h he should probably be using the types defined therein
instead]
__frank__ 写道: Which format I have to use in scanf, to format a long long int (64bits int __int64 in MS VC++). Thanks in advance
In MS VC++, '__int64' read by this way
__int64 i;
scanf("%I64d", &i);
"kaikai" <zi********@gma il.com> writes: __frank__ 写道: Which format I have to use in scanf, to format a long long int (64bits int __int64 in MS VC++). Thanks in advance In MS VC++, '__int64' read by this way __int64 i; scanf("%I64d", &i);
And *only* (as far as I know) in MS VC++. "%I64d" is non-standard and
non-portable. Writing non-portable code is sometimes necessary, of
course.
--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Jordan Abel wrote: On 2005-10-29, Michael Mair <Mi**********@i nvalid.invalid> wrote:
__frank__ wrote:
Which format I have to use in scanf, to format a long long int (64bits int __int64 in MS VC++). Thanks in advance
"%lld" or "%lli".
Note: The long long integer types are in the language since C99; AFAIK, MS VC will not fully support C99 even in their 2005 Studio. At least in VC++6, the semantics of the 64 bit types were partially broken. If the above format does not work, you have a 64 bit type as an implementatio n specific extension; the format should be specified in the online help. Otherwise, you may have to ask in a newsgroup or forum where your implementation is topical.
BTW: If you try to keep your code conforming, you can #define the appropriate integer conversion format strings and work with them like that:
#if (defined __STDC_VERSION_ _) && __STDC_VERSION_ _ >= 199901L # define MY_SLLFORMAT "%lld" # define MY_ULLFORMAT "%llu" #elif ...... /* ask for your implementation */ ..../* Define your implementation specific MY_SLLFORMAT etc here */ #else # error Cannot define an appropriate 64 bit integer format #end
.... printf("Tit (" MY_SLLFORMAT ") for tat\n", mylonglongvar);
Usually when defining a macro for a format specifier you don't want to include the % sign, so as to allow the user to include field widths and so on
for example
#define PRIdLLONG "lld" #define PRIuLLONG "llu"
printf("Here's an example with a field width: %10"PRIdLLONG"\ n", var);
Thank you -- I did not think of this at that moment
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Keith Thompson wrote: "kaikai" <zi********@gma il.com> writes: __frank__ 写道: Which format I have to use in scanf, to format a long long int (64bits int __int64 in MS VC++). Thanks in advance In MS VC++, '__int64' read by this way __int64 i; scanf("%I64d", &i);
And *only* (as far as I know) in MS VC++. "%I64d" is non-standard and non-portable. Writing non-portable code is sometimes necessary, of course.
It is also supported by WATCOM C/C++, Borland C, and the Alpha
compiler. This, presumably, is why C99 included stdint.h, and
inttypes.h which includes abstractions for all these things.
The only problem, of course, is that nobody seriously supports C99. So
as a stop gap, you can use pstdint.h available here: http://www.pobox.com/~qed/pstdint.h
This file can be used by older compilers that don't have even partial
support for C99, and possible don't support 64 bit integers at all (you
can test for this with a #ifdef INT64_MAX in your code.)
This file includes a slightly different abstraction for print modifiers
than inttypes.h -> The macro PRINTF_INT64_MO DIFIER is used to specify
the 64bit prefix for the integer formats. So:
"%" PRINTF_INT64_MO DIFIER "d"
is (usually) the same as "%lld" or "%I64d" depending on which compiler
you are using.
--
Paul Hsieh http://www.pobox.com/~qed/ http://bstring.sf.net/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Josiah Carlson |
last post by:
Good day everyone,
I have produced a patch against the latest CVS to add support for two
new formatting characters in the struct module. It is currently an RFE,
which I include a link to at the end of this post. Please read the
email before you respond to it.
Generally, the struct module is for packing and unpacking of binary
data. It includes support to pack and unpack the c types:
byte, char, short, long, long long, char, *, and...
|
by: Carlos Moreno |
last post by:
I can't find a reasonable explanation for this.
I have a table game, with primary key gameid (an int).
If I use a where involving gameid and <, or >, or <=,
or >=, then I get a sequential scan. If I use =, then
of course I get an Index scan.
More surprising to me is the fact that using BETWEEN,
I get an Index scan!!
|
by: Joe Weinstein |
last post by:
Hi. Some DBMSes are clever enough not to go to data pages if a
knowably constant search criterion is false. Is DB2 among them?
thanks,
Joe Weinstein at BEA
|
by: L Mehl |
last post by:
I tested a FE/BE application developed in A2000 on a A2002 machine and got
this message when exiting the app. Clicking the only available button "OK",
exits the application, as intended.
The FE is just the mdb, not an mde. FE and BE are in different directories
on the same machine.
Are there settings, preferably via code, that I can add to stop this error?
Thank you for any help.
|
by: smshahriar |
last post by:
Hi,
I want to scan from the following string all the hex numbers and
populate an array of integers:
0x27 0x00
0x30 0x00
0x33 0x00
0x36 0x00
| |
by: Jack Orenstein |
last post by:
Suppose I have a table as follows:
testdb=> \d person
Table "public.person"
Column | Type | Modifiers
------------+-------------------------+-----------
id | integer | not null
age | integer |
other_info | character varying(1000) |
Indexes: person_pkey primary key btree (id),
|
by: MMcCarthy |
last post by:
This is a module that scans for files and folders on a specified path and describe them in comma separated values file in a text format.
The information is stored in this file consecutively like:
1. File Name
2. File Path and Name
3. Attributes as integer
4. Date Created
5. Date Last Accessed
6. Date Last Modified
7. Size
|
by: taufik |
last post by:
hi...
I try to make scan function working and save it in PDF format using vb.net. Right now, I be able to scan but the image that i save in PDF format cannot be open. Can somebody help me to solve this problem. This is very important to me.
Urgent
|
by: asit |
last post by:
What is scan code ??
How to know the SCAN Code of a character ???
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |