C programming question
Matthew Rice
matt-s/rLXaiAEBtBDgjK7y7TUQ at public.gmane.org
Tue Dec 23 23:45:43 UTC 2003
John Wildberger <wildberger-iRg7kjdsKiH3fQ9qLvQP4Q at public.gmane.org> writes:
> changes to the effect that I can specify on the command line the memory
> location I want to look at.
> For instance to look at memory location 68 you have to type:
> ./mem 68
> The result is:
> 2 bytes at offset 68 are: f84d
And this is better than:
od -j 68 -N 2 -t x2 /dev/mem
because??? ;)
> short x;
> ssize_t size = read( fd, &x, 4 );
Shorts aren't 4 bytes. Perhaps you should change the '4' to:
sizeof(short)
or sizeof(x)
or even better, use mmap(2).
Or even way better, read a book:
Title: Understanding the Linux Kernel
ISBN: 0-596-00213-0
It'll be much less painful.
HTH,
--
matthew rice <matt-s/rLXaiAEBtBDgjK7y7TUQ at public.gmane.org> starnix inc.
phone: 905-771-0017 x242 thornhill, ontario, canada
http://www.starnix.com professional linux services & products
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list