Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 20th, 2004, 9:53 AM   #1
panabook
Newbie
 
Join Date: Jul 2004
Posts: 4
Rep Power: 0 panabook is on a distinguished road
these are the questions i cant solve. please help
1. Write a C++ program that has the usage
makefd [-f | -d] path
that will make either a file or a directory of the name path depending on the option provided. No option
means make a file. Perform error checking particularly in association with incorrect usage. Use the functions.
int creat(const char* pathname, mode_t mode);
int mkdir(const char* pathname, mode_t mode);
to perform the create with the appropriate access modes.

2.a programmer wishes to build a C program called videostore from a source file call videostore.cpp/ the source file depends on the header file videostore.h, which is in the parent directory. the programmer wishes to define, at compile time, the symbol STOREMAX as 1000. assuming the programmers current directory is the same as that of the source file, what compile directive would be used to build the program (using CC or cc in UNIX)
panabook is offline   Reply With Quote
Old Jul 20th, 2004, 10:42 AM   #2
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Since this is homework... I need to know what YOU have TRIED so far... in order to better help you. Post some code, show that you have made a valid attempt at a solution. Specific questions instead of your homework assignment posted would probably be easier to address.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Jul 20th, 2004, 1:13 PM   #3
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
1.) (in pseudo code)

int main(int argc, char *argv[])
{

   if(argc!=2 || argc!=3)
   {
       print error message
       exit
   }

   if(argv[1] is -f)
   {
      make your file using argv[2]
   }

   else if(argv[1] is -d)
   {
      make your directory using argv[2]
   }

   else
   {
       make file using argv[1]
   }

Moe specific questions would be nice.

Also, I don't know if this is what you're looking for on #2

but

#define STOREMAX 1000 ????????
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower
Mjordan2nd is offline   Reply With Quote
Old Jul 20th, 2004, 1:50 PM   #4
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
More specific questions are better than posting just the homework assignment for sure. I'll hold off on posting code until I see an initial attempt. I was also thinking
that #define STOREMAX 1000 was the answer for number two. The directory and header stuff is probably just filler info to throw some people off.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Jul 20th, 2004, 2:31 PM   #5
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
Not to sound like an ass, but i don't know about the rest of everyone, but i am here to help, not complete peoples home work that may / may not have been attempted yet.

<Disclaimer>
Sorry if anybody got offended by my post, i just think it's better to try a few times, do some research on my own then come to the forums for help. Excuse me for being blunt.
</Disclaimer>

-Pizentios
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote
Old Jul 20th, 2004, 5:58 PM   #6
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
my sentiments exactly,

#1. Show that you have made a valid attempt at a solution.
#2. Specific questions, not a copy and paste of your assignment.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Jul 20th, 2004, 7:32 PM   #7
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
Cut the guy some slack. You all must remember what it was like to be in school, and have abrupt stages where laziness would just hit you.

Panabook, it would be nice if you would give more specific problems, and also show us what you have tried, before asking a question. That way it's easier for us to help you. We don't have to rewrite everything, just correct whatever mistakes you have made. And I certainly hope that you wouldn't have us do your entire problem for you. You don't learn anything that way.

Either way, I hope you got your problem solved. If you need any more help, just post.
__________________
&quot;Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children.&quot; - Dwight D. Eisenhower
Mjordan2nd is offline   Reply With Quote
Old Jul 20th, 2004, 9:05 PM   #8
panabook
Newbie
 
Join Date: Jul 2004
Posts: 4
Rep Power: 0 panabook is on a distinguished road
Hi,
I have an exam tomorrow and i cant seem to answer these specific questions which are in past exam papers. i have alot of content to study and am just trying to get things done quicker. if it was homework i would try to figure it out myself. thanks for the replies.
panabook is offline   Reply With Quote
Old Jul 21st, 2004, 11:36 PM   #9
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Quote:
give more specific problems, and also show us what you have tried, before asking a question. That way it's easier for us to help you
That is basically what I am trying to say...

In addition to that, a lack of planning on his part does not constitute an emergency on our part. I procrastinate all of the time... especially so when I was in college. I know how it is. Simply put, he will learn nothing if we do it for him, we need specific questions and a show of his effort.

For the record, I'm still willing to attempt to answer this question AFTER an attempt is made by the person that formed the inquiry.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:53 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC