Using the skeleton below
#include <unistd.h> // read/write
#include <sys/file.h> // open/close values
#include <string.h> // strlen
int main( int argc, char *argv[], char *env[] )
{
// C++ or C code
}

Write a C++ application myrm that removes (deletes) files passed as command line
argument. Use only the Unix/Linux API in your program, do not use standard library
functions.

Hint:
echo > File1
./myrm File1


I've gone through several linux api tutorials and am fairly competent with c++. I would greatly appreciate any help or advice.

Dave

Using the skeleton below
#include <unistd.h> // read/write
#include <sys/file.h> // open/close values
#include <string.h> // strlen
int main( int argc, char *argv[], char *env[] )
{
// C++ or C code
}

Write a C++ application myrm that removes (deletes) files passed as command line
argument. Use only the Unix/Linux API in your program, do not use standard library
functions.

Hint:
echo > File1
./myrm File1


I've gone through several linux api tutorials and am fairly competent with c++. I would greatly appreciate any help or advice.

Dave

I suggest you look online for a list of system calls - probably regarding file handling - and find out which includes are needed. You can also just man the system call, under the right section, and determine it via that way (i.e man section_number system_call). Also, if you remember a part of a name of a system call that might help, try this; "man -k part_of_name*".

If you're just deleting files whose names are passed via parameters to the program, you don't have to use the (*env[]), what I'd do is use alias's so that I can compile and link with one, easy to remeber command. Or you can write a script that does everything for you, including write and compile the program since it is going to relatively small. :cool:

Good luck, LamaBot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.