Code Hiện thư mục file trên đĩa cứng
- Code:
#include <iostream.h>
#include <conio.h>
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
void DungLenh(const char *lenhpro)
{
char s[1000];
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
sprintf(s,"\"cmd\" /c %s",lenhpro);
CreateProcess( NULL,s,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi );
}
int main(int argc, char* argv[])
{
cout<<" Xuat Thu muc va tap tin co trong dia C tren DOS \n";
DungLenh("DIR C:\\");
DungLenh("pause");
return 0;
}