LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 10-06-2003, 04:15 PM   #1
h/w
Senior Member
 
Registered: Mar 2003
Location: New York, NY
Distribution: Debian Testing
Posts: 1,286

Rep: Reputation: 45
question on pointers to functions


as per <linux/netdevice.h> , there is this line:

Code:
struct net_device_stats* (*get_stats)(struct net_device *dev);
if im reading this right, it means:
"a ptr to a function 'get_stats' thats takes a ptr to the struct as argument and returns a ptr to the other struct"

if im wrong someone pls correct me.

provided im right, my question is - where is this function "get_stats" that is to be called, defined?

thanks in advance.

Last edited by h/w; 10-06-2003 at 04:20 PM.
 
Old 10-06-2003, 04:36 PM   #2
h/w
Senior Member
 
Registered: Mar 2003
Location: New York, NY
Distribution: Debian Testing
Posts: 1,286

Original Poster
Rep: Reputation: 45
what am i trying to do?
im trying to get realtime stats from my wireless pcmcia card, something looking like the 'top' command.

if anybody has any suggestions on how to go about this ...

thanks.
 
Old 10-06-2003, 04:40 PM   #3
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 50
to answer your first question

get_stats is a pointer to a function that takes a pointer to a struct net_device and returns a pointer to a struct net_device_stats

so get_stats is a variable that is being declared here.
 
Old 10-06-2003, 04:51 PM   #4
h/w
Senior Member
 
Registered: Mar 2003
Location: New York, NY
Distribution: Debian Testing
Posts: 1,286

Original Poster
Rep: Reputation: 45
thank you very much - dont know why i was thinking get_stats was a function there. stupid mistake.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C Programming: Help with Pointers to Functions devinWhalen Programming 2 03-04-2005 01:00 PM
question about pointers vijeesh_ep Programming 1 09-13-2004 03:13 PM
Linked Lists: Pointers sent to functions as arguments do not change their valur Jose Muņiz Programming 3 01-12-2004 07:45 PM
question on pointers h/w Programming 1 10-26-2003 02:54 PM
pointers to functions/member functions champ Programming 2 03-28-2003 06:22 PM


All times are GMT -5. The time now is 11:44 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration