By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,605 Members | 1,491 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,605 IT Pros & Developers. It's quick & easy.

HELP! homework problem

P: 1
Hello!

For my homework problem I received the task to modify a program so that it can open,read and close a directory, without the library <dirent.h>.
Up till now I have tried to copy and paste a ready code from <dirent.h>, just to see how the program is supposed to work.
I used the explanation from the following website as a reference:
http://www.devx.com/cplus/10MinuteSolution/26748/1954?pf=true

And the program compiles without error, but the problem is, it does not print out any result, so I really wonder whether I have executed it properly.

I just wrote in the Konsole:

t06> g++ test.cc

//test.cc is the name of my program

and then t06> test

and I get back an empty prompt, and not the list of the files of the current directory:

t06>

Can anyone help me how to see the program executed?
Nov 15 '06 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 1,510
Hello!

For my homework problem I received the task to modify a program so that it can open,read and close a directory, without the library <dirent.h>.
Up till now I have tried to copy and paste a ready code from <dirent.h>, just to see how the program is supposed to work.
I used the explanation from the following website as a reference:
http://www.devx.com/cplus/10MinuteSolution/26748/1954?pf=true

And the program compiles without error, but the problem is, it does not print out any result, so I really wonder whether I have executed it properly.

I just wrote in the Konsole:

t06> g++ test.cc

//test.cc is the name of my program

and then t06> test

and I get back an empty prompt, and not the list of the files of the current directory:

t06>

Can anyone help me how to see the program executed?
I assume you are running Unix or Linux where the executable file produced by g++ is called a.out by default.
You execute it in a terminal with the command
Expand|Select|Wrap|Line Numbers
  1. ./a.out
  2.  
if you want the executable file called test, compile and execute it so
Expand|Select|Wrap|Line Numbers
  1. g++ test.cc -o test
  2. ./test
  3.  
if that does not work post the program code so it can be checked
Nov 15 '06 #2

Expert 100+
P: 1,510
It is worth noting that when you typed
t06> test
at the terminal you ran the Unix test (check file types and compare values ) command, see
http://en.wikipedia.org/wiki/Test_(Unix)
Nov 15 '06 #3

P: 2
circular queue using counter variable in c++
using array
and link list
Nov 15 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.