10 More Discussions You Might Find Interesting
1. Programming
I am attempting to create an array of function pointers. The examples I follow to do this are from:
support.microsoft.com/en-us/help/30580/how-to-declare-an-array-of-pointers-to-functions-in-visual-c
... (3 Replies)
Discussion started by: spflanze
3 Replies
2. Programming
Hello, I read from a book exercise for a challenge. How to print out each letter of char array a by two different pointers pa and ppa in the example?
I have tried my code for letter "r" by testing without full understanding as only the first one worked.
#include<stdio.h>
int main()
{
char... (17 Replies)
Discussion started by: yifangt
17 Replies
3. Programming
Hello forum memebers
As iam new to C++ programming i am little bit confuse to understand the function pointers.
Please help me to understand the function pointers with examples are suggest me good site for this,Its better if it have picturial representation ie any PPTS available in Google.... (2 Replies)
Discussion started by: rajkumar_g
2 Replies
4. Programming
I have a special character called ô. When it is declared as a character variable its showing it can be printed. But when it is declared as a character pointer variable its showing it cannot be printed. I am just wondering why its happening like this..
c1 = '@';
c2 = 'ô';
char *fp;
fp="XXô";
if... (1 Reply)
Discussion started by: sivakumar.rj
1 Replies
5. UNIX for Advanced & Expert Users
I am new to shared pointer conceot in C++ and hence require some clarification:
For example:
class A
{
public:
virtual ~A()
{
}
int x;
};
typedef boost::shared_ptr<A>... (1 Reply)
Discussion started by: uunniixx
1 Replies
6. Programming
Hi all. I am trying to use restricted pointers to allow the gcc compiler optimize the code, but I have not been able to make it work so far. I am testing with this code:
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
void vecmult(int n, int * restrict a, int... (0 Replies)
Discussion started by: carl.alv
0 Replies
7. Programming
Hi I mash with pointers in C. I solve this problem about 5 hours and I don't know how I should continue.
void InsertFirst (tList *L, int val) {
tElemPtr new;
if((new = malloc(sizeof(tElemPtr))) == NULL) Error();
new->data = val;
new->ptr = L->frst;
L->frst = new;... (2 Replies)
Discussion started by: Milla
2 Replies
8. Programming
is this a valid c declaration
int (*ptr(int *b));
plz explain... (4 Replies)
Discussion started by: areef4u
4 Replies
9. Programming
hi all,
let say i have a pointer exit, and this exit will store some value. how can i store the value that the pointer points to into an array and then print them out from the array.
thanks in advance (2 Replies)
Discussion started by: dianazheng
2 Replies
10. Programming
I am pondering the next question:
Can I safely sare objects that have virtual functions (i.e. have
virtual function table pointers) between two processes ?
Where will the pointers point to in each process ?
What I am afraid of is that in the creating process the pointer
will indeed point to... (2 Replies)
Discussion started by: Seeker
2 Replies
sg_get_network_io_stats(3) Library Functions Manual sg_get_network_io_stats(3)
NAME
sg_get_network_io_stats, sg_get_network_io_stats_diff - get network statistics
SYNOPSIS
#include <statgrab.h>
sg_network_io_stats *sg_get_network_io_stats(int *entries);
sg_network_io_stats *sg_get_network_io_stats_diff(int *entries);
DESCRIPTION
Both calls take a pointer to an int, entries, which is filled with the number of network interfaces the machine has. This is needed to know
how many sg_network_io_stats structures have been returned. A pointer is returned to the first sg_network_io_stats.
sg_get_network_io_stats returns the network traffic stored in the kernel which holds the amount of data transferred since bootup. On some
platforms, such as Solaris 7, this value is stored in a 32bit int, so wraps around when it reaches 4GB. Other platforms, such as Solaris 8,
hold the value in a 64bit int, which wraps somewhere near 17 million terabytes.
sg_get_network_io_stats also returns the number of packets sent and received, and the number of errors that have occured. It also makes the
number of collisions available.
sg_get_network_io_stats_diff is the same as sg_get_network_io_stats except it will return the difference since the last call. So, for
instance a call to sg_get_network_io_stats_diff is made, and called again 5 seconds later. Over that time, 20 bytes of traffic was trans-
mitted and 10 bytes received. Tx will store 20, rx will store 10 and systime will store 5. This function copes with wrap arounds by the O/S
so should be seemless to use.
RETURN VALUES
All network statistics return a pointer to a structure of type sg_network_io_stats.
typedef struct{
char *interface_name;
long long tx;
long long rx;
long long ipackets;
long long opackets;
long long ierrors;
long long oerrors;
long long collisions;
time_t systime;
}sg_network_io_stats;
interface_name
The name known to the operating system. (eg. on linux it might be eth0)
tx The number of bytes transmitted.
rx The number of bytes received.
ipackets
The number of packets received.
opackets
The number of packets transmitted.
ierrors
The number of receive errors.
oerrors
The number of transmit errors.
collisions
The number of collisions.
systime
The time period over which tx and rx were transferred.
BUGS
On the very first call sg_get_network_io_stats_diff will return the same as sg_get_network_io_stats. After the first call it will always
return the difference.
On operating system that hold only 32bits of data there is a problem if the values wrap twice. For example, on Solaris 7 if 9GB is trans-
ferred and the operating system wraps at 4GB, the sg_get_network_io_stats_diff function will return 5GB.
SEE ALSO
statgrab(3)
WEBSITE
http://www.i-scream.org/libstatgrab/
i-scream $Date: 2005/04/25 11:25:45 $ sg_get_network_io_stats(3)