473,473 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Is there such a thing as a Hexadecimal Long Int?

7 New Member
I am writing code in C to print out various data values from some test I am running. The data results come in ints, long ints, floats and doubles.

Most data values are required to be in decimal, but certain data values only make sense if they are printed in hex. The values are all stored as decimal values, and then I just convert them to hex when I print them out:

printf("0x%x", myVal);

So, what if myVal is stored in my data file as a long decimal int.... Is there some way to specify a long hex integer, or should I just print out some error message instead and look into the issue further if it ever even happens?

If the long int case is usually handled:
printf("%ld", myVal);

Is the long hex int case then handled:
printf("%lh", myVal);
?
Sep 23 '08 #1
2 1538
boxfish
469 Recognized Expert Contributor
I know absolutely nothing about printf, but I googled it. Here's the reference page I found. Is printf("%lx", longHexVar); what you're looking for?
Sep 23 '08 #2
KioKrofov
7 New Member
excellent! thanks so much
Sep 24 '08 #3

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

Similar topics

1
by: Mike Jeffers | last post by:
Hi everyone, I need to convert data from a structure into hexadecimal ascii format. The structure is like this: struct ROOM_DATA { short room_number; short floor_number; long total_area;
6
by: Hong Kong Phooey | last post by:
I feel dumb asking this, haveing programmed in VB for so long, but here goes... What is the rule for putting an ampersand (&) at the END of a hexadecimal number in VB? For example: Dim x As...
27
by: Matt | last post by:
Does the language have header files containing definitions of numbers such as pi and e? I believe some implementations used to have those, but I can't find them in Stroustrup. Thanks.
8
by: Vijay | last post by:
Hi , I am doing a small project in c. I have a Hexadecimal file and want to convert into ascii value. (i.e., Hexadecimal to Ascii conversion from a file). Could anyone help me? Thanks in...
14
by: dharmdeep | last post by:
Hi friends, I need a sample code in C which will convert a Hexadecimal number into decimal number. I had written a code for that but it was too long, I need a small code, so request u all to...
7
by: elliotng.ee | last post by:
I have a text file that contains a header 32-bit binary. For example, the text file could be: %%This is the input text %%test.txt Date: Tue Dec 26 14:03:35 2006...
11
by: sweeet_addiction16 | last post by:
hello im programming in c.i have to write about 100 hexadecimal values in to a file. how do i do it?pls help me
6
by: sweeet_addiction16 | last post by:
hello Im writin a code in c... can sum1 pls help me out in writing a c code to convert decimalnumber to hexadecimal number.The hexadecimal number generated has to be an unsigned long.
11
by: =?Utf-8?B?VHJlY2l1cw==?= | last post by:
Hello, Newsgroupians: I've a question regarding Hexadecimal to binary conversion. Suppose I have a long hexadecimal string, and I would like to convert it to a binary string. How can I...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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 project—planning, coding, testing,...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
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...

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.