Sponsored Content
Full Discussion: How type casting works ?
Top Forums UNIX for Advanced & Expert Users How type casting works ? Post 302321882 by jim mcnamara on Tuesday 2nd of June 2009 10:05:54 AM
Old 06-02-2009
It is up to the programmer to set up a correct cast. If the object has fewer bytes than what it is cast to - then you can read/write past the end of the object, a data overrun. Which results, usually, in odd behavior, data corruption or sometimes a segfault or a sigbus error...
 

9 More Discussions You Might Find Interesting

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

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

3. Shell Programming and Scripting

casting

Hi everyone, I was wondering how i could cast a floating value to an integer in csh Thanks (0 Replies)
Discussion started by: ROOZ
0 Replies

4. Shell Programming and Scripting

Problem with type-casting in awk

Hi I'm trying to write a script which takes an integer as input and checks for files with size > input and displays it on screen. The code I've tried : echo 'Enter the min file size expected' read filesize du -ah <folder name> | awk -F: '$1>int(filesize) {print $1,$2)' is always... (28 Replies)
Discussion started by: vivek.bharadwaj
28 Replies

5. UNIX for Dummies Questions & Answers

>./a.pl works, >a.pl - does not

When I try to execute script, I get message: >aa.pl zsh: command not found: aa.pl but >./aa.pl works OK. What to change in environment to force the former way to work? Thank you, Alex Z (4 Replies)
Discussion started by: zzol
4 Replies

6. Programming

C++ type-casting a member variable in const methods

Is it permitted to type-cast a member variable passed in as a parameter in a member const method .. I am doing something like : in a return-type method () const { variable other = long(member variable) } this other assigned variable is not updating and I wonder if type-casting in such... (1 Reply)
Discussion started by: shriyer123
1 Replies

7. Shell Programming and Scripting

Type casting problem

hi guys, i m new to shell script.. i dont know how to type cast string into integers and i mention my problem below.. date="21091988" month=$((${date:2:2})) # extract the month from previous date variable temp=$(($month*23)) when i am trying to calculate the temp value i got the... (5 Replies)
Discussion started by: raadhaakrishnan
5 Replies

8. Shell Programming and Scripting

Casting the data command !

Hey guys. 1st problem: I have to create a script for every hour run a script against a DB and then produce results to log file and eventually email. I have to manipulate the date command from something like this date '+%F %H:%M.%s' which produces the below the below result 2014-08-01... (2 Replies)
Discussion started by: mo_VERTICASQL
2 Replies

9. Programming

Very strange output with casting

Hi All, I am having a strange issue. Below is the code snippet. If I print fraction * (double)::pow((double)10,scalingFactor) which is a double I am getting 154 when I type cast that to int as (int)( ((fraction) * ((double)::pow((double)10,scalingFactor)))) it is becoming 153. Not sure why... (0 Replies)
Discussion started by: arunkumar_mca
0 Replies
INET6_RTHDR_SPACE(3)					   BSD Library Functions Manual 				      INET6_RTHDR_SPACE(3)

NAME
inet6_rthdr_space, inet6_rthdr_init, inet6_rthdr_add, inet6_rthdr_lasthop, inet6_rthdr_reverse, inet6_rthdr_segments, inet6_rthdr_getaddr, inet6_rthdr_getflags -- IPv6 Routing Header Options manipulation LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sys/types.h> #include <netinet/in.h> size_t inet6_rthdr_space(int type, int segments); struct cmsghdr * inet6_rthdr_init(void *bp, int type); int inet6_rthdr_add(struct cmsghdr *cmsg, const struct in6_addr *addr, unsigned int flags); int inet6_rthdr_lasthop(struct cmsghdr *cmsg, unsigned int flags); int inet6_rthdr_reverse(const struct cmsghdr *in, struct cmsghdr *out); int inet6_rthdr_segments(const struct cmsghdr *cmsg); struct in6_addr * inet6_rthdr_getaddr(struct cmsghdr *cmsg, int index); int inet6_rthdr_getflags(const struct cmsghdr *cmsg, int index); DESCRIPTION
RFC2292 IPv6 advanced API defines eight functions that the application calls to build and examine a Routing header. Four functions build a Routing header: inet6_rthdr_space() return #bytes required for ancillary data inet6_rthdr_init() initialize ancillary data for Routing header inet6_rthdr_add() add IPv6 address & flags to Routing header inet6_rthdr_lasthop() specify the flags for the final hop Four functions deal with a returned Routing header: inet6_rthdr_reverse() reverse a Routing header inet6_rthdr_segments() return #segments in a Routing header inet6_rthdr_getaddr() fetch one address from a Routing header inet6_rthdr_getflags() fetch one flag from a Routing header The function prototypes for these functions are all in the <netinet/in.h> header. The full description of these functions is available in RFC2292. DIAGNOSTICS
inet6_rthdr_space() returns 0 on errors. inet6_rthdr_add(), inet6_rthdr_lasthop() and inet6_rthdr_reverse() return 0 on success, and returns -1 on error. inet6_rthdr_init() and inet6_rthdr_getaddr() return NULL on error. inet6_rthdr_segments() and inet6_rthdr_getflags() return -1 on error. EXAMPLES
RFC2292 gives comprehensive examples in chapter 8. SEE ALSO
W. Stevens and M. Thomas, Advanced Sockets API for IPv6, RFC2292, February 1998. S. Deering and R. Hinden, Internet Protocol, Version 6 (IPv6) Specification, RFC2460, December 1998. HISTORY
The implementation first appeared in KAME advanced networking kit. STANDARDS
The functions are documented in ``Advanced Sockets API for IPv6'' (RFC2292). BUGS
The text was shamelessly copied from RFC2292. inet6_rthdr_reverse() is not implemented yet. BSD
December 10, 1999 BSD
All times are GMT -4. The time now is 04:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy