C code


 
Thread Tools Search this Thread
Top Forums Programming C code
# 1  
Old 06-10-2009
C code

Hi

I don't understand this code line:
Code:
struct iphdr *iph=(struct iphdr *)data;

where data is an u_char.
What I can see is that we are creating a pointer (iph) to a iphdr struct, but the right side is not very clear. Can anyone explain the meaning, please?

Thanks in advance

Dedalus

-----Post Update-----

ok
i got it, is a casting operation

Thanks

D.
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Linux

Go to a line of code , skip few lines of code

Hi , I have a code where i am using a infinite while loop . some thing like below while do if then #go to line 20 fi command 1; command 2; #line 20: sleep 34; (5 Replies)
Discussion started by: Paarth
5 Replies

2. Shell Programming and Scripting

Block of code replacement in Java source code through Unix script

Hi, I want to remove the following code from Source files (or replace the code with empty.) from all the source files in given directory. finally { if (null != hibernateSession && hibernateSession.isOpen()) { //hibernateSession.close(); } } It would be great if the script has... (2 Replies)
Discussion started by: hareeshram
2 Replies

3. UNIX for Dummies Questions & Answers

If ‘922’ Code does not exist on ‘03’ Record, ‘901’ Code will be there instead, move ‘03’ R

01,011600033,011600033,110516,0834,2,90,,2/ 02,011600033,011103093,1,110317,0834,,2/ 03,105581,,015,+00000416418,,,901,+00000000148,,,922,+000000 00354,,/ 03,113806,,015,+00000559618,,,901,+00000000096,,,922,+000000 00621,,/ 88,902,+0000000025218,,/... (1 Reply)
Discussion started by: sgoud
1 Replies

4. Shell Programming and Scripting

translate ksh code to csh code

hi all, Can any 1 help me translate this korn shell code to C shell code : email=$(grep "^$1" $folder/config_2.txt | awk '{print $2'}) In config_2.txt the content is : which mean in korn shell , $1=groupname and $2=email address. Now i need to write in C shell script,when i set the... (2 Replies)
Discussion started by: proghack
2 Replies

5. Programming

how i prepare a c++ code(c code) for implementing my own protocol format

helo my protocol format is given below { destno,mode,no.of packet,pktsize,,pktno,textsize,CRC} description:- { is starting flag destno - 4bytes mode - 1 byte no.of pkt - 4byes pktsize - 6 bytes ... (1 Reply)
Discussion started by: amitpansuria
1 Replies

6. UNIX for Advanced & Expert Users

Return code from PL/SQL Code

Hi Guys, I was just wondering if anybody can help me with this problem. OK, how we can get a value back from PL/SQL Script (not stored procedure/function) See the below example: (for example aaa.sh) #!/bin/ksh VALUE=`sqlplus -s user/password@test_id <<EOF @xxx.sq EOF` echo $VALUE ... (7 Replies)
Discussion started by: Shaz
7 Replies
Login or Register to Ask a Question
TODR(9) 						   BSD Kernel Developer's Manual						   TODR(9)

NAME
todr_attach, todr_gettime, todr_settime, clock_ymdhms_to_secs, clock_secs_to_ymdhms -- time-of-day clock support SYNOPSIS
#include <dev/clock_subr.h> void todr_attach(todr_chip_handle_t); int todr_gettime(todr_chip_handle_t, struct timeval *); int todr_settime(todr_chip_handle_t, struct timeval *); void clock_secs_to_ymdhms(int, struct clock_ymdhms *); time_t clock_ymdhms_to_secs(struct clock_ymdhms *); DESCRIPTION
The todr_*() functions provide an interface to read, set and control 'time-of-day' devices. A driver for a 'time-of-day' device registers its todr_chip_handle_t with machine-dependent code using the todr_attach() function. Alternatively, a machine-dependent front-end to a 'time-of-day' device driver may obtain the todr_chip_handle_t directly. The todr_gettime() retrieves the current data and time from the TODR device and returns it in the struct timeval storage provided by the caller. todr_settime() sets the date and time in the TODR device represented by todr_chip_handle_t according to the struct timeval argument. The utilities clock_secs_to_ymdhms() and clock_ymdhms_to_secs() are provided to convert a time value in seconds to and from a structure rep- resenting the date and time as a <year,month,day,weekday,hour,minute,seconds> tuple. This structure is defined as follows: struct clock_ymdhms { u_short dt_year; /* Year */ u_char dt_mon; /* Month (1-12) */ u_char dt_day; /* Day (1-31) */ u_char dt_wday; /* Day of week (0-6) */ u_char dt_hour; /* Hour (0-23) */ u_char dt_min; /* Minute (0-59) */ u_char dt_sec; /* Second (0-59) */ }; Note: leap years are recognised by these conversion routines. RETURN VALUES
The todr_*() functions return 0 if the requested operation was successful; otherwise an error code from <sys/errno.h> shall be returned. However, behaviour is undefined if an invalid todr_chip_handle_t is passed to any of these functions. The clock_ymdhms_to_secs() function returns -1 if the time in seconds would be less that zero or too large to fit in a time_t. The clock_secs_to_ymdhms() function never fails. SEE ALSO
intersil7170(4), mk48txx(4), inittodr(9), resettodr(9), time_second(9) BSD
September 6, 2006 BSD