Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a C program to print the program itself ?!

Answer Posted / jaroosh

The most simple possible program printing itself on windows :
main()
{
char path[255];
sprintf(path,"cmd.exe /c type \"%s\"",__FILE__);
system(path);
}

on Unix you just use "cat" instead of "type" and necessary
fun to call bash command from c program.

Is This Answer Correct ?    17 Yes 23 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the g value paradox?

1118


Why main is used in c?

1023


Why can't I perform arithmetic on a void* pointer?

1061


Are negative numbers true in c?

1008


Calculate 1*2*3*____*n using recursive function??

1993


Why c is known as a mother language?

1047


What is selection sort in c?

1030


Why is c not oop?

937


What is %d called in c?

1189


What is the best style for code layout in c?

1064


What is the return type of sizeof?

1033


What is build process in c?

1093


What type is sizeof?

1010


the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function

1279


What is %g in c?

1028