Sunday 6 January 2008

How to create dos command in c?



(1) Create a dos command: type by c program.



Answer:




Step 1: Write following code.




#include

void main(int count,char * argv[])

{

int i;

FILE *ptr;

char *str;

char ch;

if(count==1)

{

printf("The syntax of the command is incorrect.\n");

}

for(i=1;i
{

ptr=fopen(argv[i],"r");

if(ptr==NULL)

{

printf("The system cannot find the file specified.");

if(

No comments:

Post a Comment