Hi!!! all
i got a program which shows its own source code as output but i m unable to understand what it is plz HELP and EXPLAIN it.
char *f="char*f=% c%s%c;main( ){printf( f,34,f,34, 10);}%c";
main()
{
printf(f,34, f,34,10);
}
Do we have any other way to create the program which shows its source code.
3 1269
Hi!!! all
i got a program which shows its own source code as output but i m unable to understand what it is plz HELP and EXPLAIN it.
char *f="char*f=% c%s%c;main( ){printf( f,34,f,34, 10);}%c";
main()
{
printf(f,34, f,34,10);
}
Do we have any other way to create the program which shows its source code.
Okay, well, what is happening is that you are defining a character string which contains a tricky spot of code, as well as the entire body of your program. The program then prints the character string by playing around the the printf() function.
You might want to consider looking up escape characters in your favorite c/c++ reference material. I think you'll find you have a few spots where you need to escape your punctuation marks.
HI:
i had to write this program for my prof afew days ago , and i wrote exactly what you have wrie here for my prof but unfortunatley he said that it isn't correct.please tell me why?!!!????
the other way to print the source code is to send argument to main function and
print the own file of program like this: -
int main(char *argc ,int argv[1])
-
{
-
FILE *pt;
-
pt=fopen("argv[0]","rb");
-
printf("%p",*pt);
-
}
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Anthony Papillion II |
last post by:
Hello Everyone,
I have downloaded and installed mod_python and it doesn't seem to be
working. I am hoping someone can give me some pointers as to what I am doing
wrong. Here are the steps I've...
|
by: Michael Dekson |
last post by:
Hello,
Can I exe file made in Microsoft Visual C++ decompile into source code.
If it is possibly please tell me how.
Thanks
|
by: Prashanth Badabagni |
last post by:
Hi ,
I'm Prashanth Badabagni .. I have and idea how a program prints
it's own source code ..
void main()
{
FILE *P;
char *file,c;
strcpy(file,__FILE__);
p=fopen(file,"r");
|
by: wana |
last post by:
I was reading through original source code of ping for some insight
and was confused by unusual code.
Entire listing available at:
http://www.ping127001.com/pingpage/ping.html
#include...
|
by: James Jenkins |
last post by:
Hi - This auction will end in a very short time... Please take a look. It
contains some very usefull .NET 2 code
I have been working on a Bandwidth Monitoring program for 3 months now
but am...
|
by: Tina |
last post by:
In 1.1 I used to use a WebControlLibrary to hold code I didn't want to
expose when I distributed a component. The code would compile to a separate
dll and could not be viewed when used in a vs.net...
|
by: Tomás Ó hÉilidhe |
last post by:
I'd post this on a gcc newsgroup but I'd be more productive talking
to the wall.
Anyway, let's say someone throws some source code at you for a
particular program and says, "Just compile it, it...
|
by: mikhal80 |
last post by:
Is it possible to write a program which would print out it's own
source code, using C++?
|
by: Adeel Hasan Akbari |
last post by:
Hi!
I'm new to this field.
Actually i'm a new programmer. And i've never worked in C.
It is my humble request to you to provide me with the source code for
Spaceball (the game in which there's...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |