Sponsored Content
Full Discussion: key_t type
Top Forums UNIX for Dummies Questions & Answers key_t type Post 302469394 by joker40 on Friday 5th of November 2010 06:16:00 PM
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
 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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. 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

7. 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

8. 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

9. 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
FTOK(3) 						     Linux Programmer's Manual							   FTOK(3)

NAME
ftok - convert a pathname and a project identifier to a System V IPC key SYNOPSIS
#include <sys/types.h> #include <sys/ipc.h> key_t ftok(const char *pathname, int proj_id); DESCRIPTION
The ftok() function uses the identity of the file named by the given pathname (which must refer to an existing, accessible file) and the least significant 8 bits of proj_id (which must be nonzero) to generate a key_t type System V IPC key, suitable for use with msgget(2), semget(2), or shmget(2). The resulting value is the same for all pathnames that name the same file, when the same value of proj_id is used. The value returned should be different when the (simultaneously existing) files or the project IDs differ. RETURN VALUE
On success, the generated key_t value is returned. On failure -1 is returned, with errno indicating the error as for the stat(2) system call. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +----------+---------------+---------+ |Interface | Attribute | Value | +----------+---------------+---------+ |ftok() | Thread safety | MT-Safe | +----------+---------------+---------+ CONFORMING TO
POSIX.1-2001, POSIX.1-2008. NOTES
On some ancient systems, the prototype was: key_t ftok(char *pathname, char proj_id); Today, proj_id is an int, but still only 8 bits are used. Typical usage has an ASCII character proj_id, that is why the behavior is said to be undefined when proj_id is zero. Of course, no guarantee can be given that the resulting key_t is unique. Typically, a best-effort attempt combines the given proj_id byte, the lower 16 bits of the inode number, and the lower 8 bits of the device number into a 32-bit result. Collisions may easily happen, for example between files on /dev/hda1 and files on /dev/sda1. SEE ALSO
msgget(2), semget(2), shmget(2), stat(2), svipc(7) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. GNU
2015-08-08 FTOK(3)
All times are GMT -4. The time now is 08:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy