[PLUG] Trying to learn low level Linux programming for cs201...

Ronald Chmara ronabop at gmail.com
Sat Jan 10 05:33:48 UTC 2009


On Jan 9, 2009, at 2:48 PM, Michael Robinson wrote:

> I am getting a bad file descriptor error when I try to use myWrite.
> I am stumped at this point.  The reason I am using myWrite and myRead
> wrapper functions is to make this program compatible with gprof.
> The point of the whole program, not here, is to copy one file to
> another destructively.

Ah, that sounds an awful lot like a classic CS homework assignment/ 
job interview question, slightly rephrased (and yes, I've actually  
been asked this very question in job interviews), where one is asked  
to re-write the program 'cat', which can copy files, append files, or  
create files.... all from other files or source inputs.

Source at:
http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/cat.c

Always a good thing to look at and learn from.

:)

-Bop




More information about the PLUG mailing list