key_t type


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers key_t type
# 1  
Old 11-05-2010
key_t type

I would like to print value of key generate like this....

Code:
key_t k = ftok(".",'c');
printf("key is %d \n" , k);

Is there other way to print this type. I dont think I am getting right output which is
key is 1662074913 (shouldn't it be 6362074913) since 'c' is 63 in hex (ascii table). Instead of using %d is there other way to do this.

Last edited by joker40; 11-05-2010 at 07:32 PM.. Reason: adding
# 2  
Old 11-06-2010
keys are indeed ordinary integers, at least on my system, but if you're looking for a hex value you should print with %x. Right now you're printing base-ten, which of course won't show a hexadecimal 63 anywhere.

For a more complete listing of printf's formatting specifiers, see man 3 printf.
This User Gave Thanks to Corona688 For This Post:
# 3  
Old 11-07-2010
Up to recently key_t was an opaque type. Now, as a result of Austin Group Interpretation 1003.1-2001 #033, POSIX.1-2008 requires key_t to be an arithmetic type.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

Changing type name

In C++, how can I change the type with another name For example How can I declaring an object real which would be the same as declaring it float (5 Replies)
Discussion started by: kristinu
5 Replies

2. Windows & DOS: Issues & Discussions

Type of RAM

Hello All Is there a way I can find out the type of RAM (DDR1 or DDR2 or DDR3), I'm using withoout opening the cabinet? Any Windows command? Thanks in advance. (5 Replies)
Discussion started by: tenderfoot
5 Replies

3. Programming

key_t type max length or boundaries value

Hello, In shared memory, when using shmget function, first parameter is ket_t key. I know it is an integer type, but length of it is system dependent. That means may not be have integer's ranges. What is range of key_t in Linux? Is it different in distros, for example in ubuntu & fedora? (2 Replies)
Discussion started by: pronetin
2 Replies

4. UNIX for Dummies Questions & Answers

Encoding Type

Hi, Where can I find the encoding type in a unix server ? Thanks in advance !!! (1 Reply)
Discussion started by: risshanth
1 Replies

5. Solaris

raid type

how to get the raid type of a mount if I am using solaris disksuite? thanks (1 Reply)
Discussion started by: melanie_pfefer
1 Replies

6. Programming

array type has incomplete element type

Dear colleagues, One of my friend have a problem with c code. While compiling a c program it displays a message like "array type has incomplete element type". Any body can provide a solution for it. Jaganadh.G (1 Reply)
Discussion started by: jaganadh
1 Replies

7. Shell Programming and Scripting

String type to date type

Can one string type variable changed into the date type variable. (1 Reply)
Discussion started by: rinku
1 Replies

8. Programming

keyboard type

hi I am using a GUI language (based on C/C++) for my application. Now i need to identify the "Again" key in the Sun keyboard. I tried to do this by getting the ascii value (4155)of it . it was fine. but it is clashing with F12, whose ascii is 4155 in normal keyboards. Due to this either one of... (0 Replies)
Discussion started by: nimishm
0 Replies

9. UNIX for Dummies Questions & Answers

you have more and one unix type?

As a formem unix newbe I Just wanted to tell you about this cool site for all you confused people. If you need to support more than one unix type: Use this one. It's a life saver. http://www.unixguide.net/unixguide.shtml here (4 Replies)
Discussion started by: sunbird
4 Replies
Login or Register to Ask a Question