-
Help Needed
ok, I am a newbie to c & I want to make a basic program in ms-dos. But I can never seem to execute commands properly, check this out:
<!-- Crappy Code Begin --!>
#include <stdio.h>
main()
{
system("dir");
}
<!-- Crappy Code End --!>
Now when I compile & run this thing it never works, all it is supposed to do is the 'dir' command in ms-dos but all I get is a blank black screen.
What am I doing wrong here people?
-
Works fine on my machine (Windows NT/VC++ 6.0):
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
system("dir");
getchar();
return 0;
}
-
Also works fine with me (Windows 98/GCC 3.03.
What OS and compiler are you using?
-
I am using
I am using Windows 98 with the Miracle C compiler, But that code worked fine, thanx. Must have just been the return 0;
-
ahh crap, it don't work but I thought it did :(
I was typing dir.exe (the name of the program) to execute it & it just brang up a list of directories, but when I renamed it & executed it again I found out that it didn't actually work.
Anybody know what the problem is?
-
-
Thanx
ok thanx, it was just the compiler :(. I can now execute commands like dir, time & date in ms-dos.
But how would I go about doing commands such as cd c:\?
I tried system("cd c:\"); without any luck.
This is the last question I will ask.
Many Thanx