Welcome to Dream.In.Code
Become a C++ Expert!

Join 149,489 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,293 people online right now. Registration is fast and FREE... Join Now!




C++ and Linux

 
Reply to this topicStart new topic

C++ and Linux

Dave256000
28 Feb, 2007 - 11:20 AM
Post #1

New D.I.C Head
*

Joined: 28 Feb, 2007
Posts: 1


My Contributions
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 to write the message Hello Brighton to the
terminal using the Unix/Linux API only. The output should be of the form:


#include <unistd.h> //read/write
#include <sys/file.h> //open/close values
#include <string.h> //strlen

int main( int argc, char* argv[], char* env[] )
{
for ( int i=1; i<argc; i++ )
{
write( 1, argv[i], strlen( argv[i] ) );
write( 1, " ", 1 );
}
write( 1, "Hello Brighton" , 14 );
}


ok, i managed to get the last question, could someone please give me an idea how to do the following?:
same skeleton is used.


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

User is offlineProfile CardPM
+Quote Post

Nova Dragoon
RE: C++ And Linux
28 Feb, 2007 - 11:24 AM
Post #2

The Innocent Shall Suffer, Big Time
Group Icon

Joined: 16 Aug, 2001
Posts: 6,145



Thanked: 8 times
Dream Kudos: 515
Expert In: Python, Linux

My Contributions
look at the unlink syscall for deletion
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/7/09 05:18PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month