Welcome to HBH! If you had an account on hellboundhacker.org you will need to reset your password using the Lost Password system before you will be able to login.

print directories


ghost's Avatar
0 0

can anyone tell what commands do i need for a program in c, to print in the screen the directories? like command "dir" for windows, or "ls" for linux???thanx.


ghost's Avatar
0 0

well i believe there is a command in which you do something like command("") or something, but look it up because i dont really know C++.


ghost's Avatar
0 0

That was certainly helpful.

There is a command called 'system' in stdlib.h for in an ANSI-compliant setup. It works, but the return isn't very helpful, and without overloading support like C#, it can be bothersome for more than destructive applications that just do rm -rf /.

Try using execl() instead, coupled with fork or pipe.


ghost's Avatar
0 0

At least I tried, instead of bashing someone whom I didn't even do anything to.


SySTeM's Avatar
-=[TheOutlaw]=-
20 0

I'd just use system("dir") if I was on windows, although this is for C++, I don't know if it would work in C


ghost's Avatar
0 0

…:D