This example will show how to use the DOS command in C and rediret its output to a file..
#include <stdio.h> #include<conio.h> void main () { FILE *fp; clrscr(); printf ("Checking if processor is available..."); if (system(NULL)) { puts ("Ok"); } else { printf("Processor is not available"); getch(); exit (1); } system ("dir>c:\dirlist.txt"); printf("Done!!File created"); getch(); }output:will create the file with name dirlist in the "c:\" drive..........
Nice job milanji
ReplyDeletethnx....
ReplyDelete