logo

CuriousTab

CuriousTab

Discussion


Home Technical Questions Programming Comments

  • Question
  • Write a c program to create dos command type.


  • Correct Answer
  • #include int 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;i2) printf("\nError occurred while procesing : %s\n",argv[i]); } else { if(count>2) { printf("%s\n\n",argv[i]); } while((ch=getc(ptr))!=-1) printf("%c",ch); } fclose(ptr); } return 0; } Save the above file as openc, compile and execute the go to command mode (current working directory) and write: open xyc (xyc any file present in that directory) To run the open command in all directories and drive you will have to give the path of current working directory in command mode Write: C:tc\bin>PATH c:\tc\bin Now press enter key Now your open command will work in all directory and drive 


  • Programming problems


    Search Results


    • 1. What will be output when you will execute following c code? #include enum actor { SeanPenn=5, AlPacino=-2, GaryOldman, EdNorton }; void main() { enum actor a=0; switch(a) { case SeanPenn: printf("Kevin Spacey"); break; case AlPacino: printf("Paul Giamatti"); break; case GaryOldman:printf("Donald Shuterland"); break; case EdNorton: printf("Johnny Depp"); } }

    • Options
    • A. Kevin Spacey
    • B. Paul Giamatti
    • C. Donald Shuterland
    • D. Johnny Depp
    • Discuss
    • 2. What will be output of following c code? void main() { struct bitfield { unsigned a:5; unsigned c:5; unsigned b:6; }bit; char *p; struct bitfield *ptr,bit1={1,3,3}; p=&bit1; p++; clrscr(); printf("%d",*p); getch(); }
    • Discuss
    • 3. What will be output of following c code? #include int main() { int i; for(i=10;i<=15;i++){ while(i){ do{ printf("%d ",1); if(i>1) continue; }while(0); break; } } return 0; }
    • Discuss
    • 4. How would you use qsort() function to sort an array of structures?
    • Discuss
    • 5. If I use the following printf() to print a long int why I am not warned about the type mismatch? printf ("%d",num );
    • Discuss
    • 6. Why we use do-while loop in c?
    • Discuss
    • 7. Swap two variables without using third variable.
    • Discuss
    • 8. Write a program to generate the Fibonacci series in c?
    • Discuss
    • 9. C program to find the factorial of a given number
    • Discuss
    • 10. Write a c program to check whether a number is strong or not.
    • Discuss


    Comments

    There are no comments.

Enter a new Comment