C programming question

John Wildberger wildberger-iRg7kjdsKiH3fQ9qLvQP4Q at public.gmane.org
Wed Dec 24 00:54:28 UTC 2003


On December 23, 2003 06:45 pm, Matthew Rice wrote:

> And this is better than:
>
>         od -j 68 -N 2 -t x2 /dev/mem
>
> because??? ;)

You don't get an argument from me on this. :-)
I actually used this to verify my program. It is short, but not as much 
educational as writing a C- program.
>
> > 	    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)

It does not chane the result. I used the 'short' to get away from a printout 
with four bytes (high order first, followed by low order) which was confusing
and not what was asked.
>
> or even better, use mmap(2).
I will experiment with this as a next step in my education.

>
> Or even way better, read a book:
Better, but a lot more cumbersome. In addition, it is very hard to find what 
one needs in specific cases. Just read some of the responses to my original 
question and you will see that my problem was not of a nature to bring 
forward answers from people that have read a lot of the pertinent books.

>
>         Title: Understanding the Linux Kernel
>         ISBN:  0-596-00213-0
>
> It'll be much less painful.

Thans for your response,
John


--
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