issuing a command using c code
I am working in Linux. I have written a kernel module that creates a file called /proc/my_clock.
I need to write an integer returned from function, gettimeofday(), to /proc/my_clock using c code. I have a couple of ideas but I am not sure which would be better.
idea1 - use a file pointer to write a buffer containing the integer(s)
idea2 - use sprintf of fprintf to write a buffer containing the integer(s)
No other ideas at this point. Any info would help...
Thanks
ideas before writing the code
gettimeofday returns two integers. the first integer represents seconds and the seconds integer represents microseconds...
Anyway, its irrelevant.
The linux environment is tricky. You can do things that will destroy networks when changing kernel variables. I don't want to do that -definitely.
I will post my code later tonite.
Peace
Re: ideas before writing the code
Quote:
Originally posted by DMaxJ
gettimeofday returns two integers. the first integer represents seconds and the seconds integer represents microseconds...
Anyway, its irrelevant.
No it doesn't. No function in C can return more than one value. Not unless you're wrapping them in a returned structure. And if that's the case, then you're still only actually returning one object. In C, any given function can only ever return one object.
If you don't believe me, simply read the man page.
Quzah.