How to display the program code as output using C or C++
-
hai, i would like to display the coding. Means, while i m running my C/C++ program the output should be of the program coding which i m execting..... how can i do it? Help me! Thanks for understanding!!!
You need to (A) debug a debugger or (B) dissasemble/decompile a dissasembler/decompiler Then, the program running would be doing nothing other than producing output that contained the program's source-code I don't understand your question, as it stands. The effort would be pointless - an act of 'because I can'
-
You need to (A) debug a debugger or (B) dissasemble/decompile a dissasembler/decompiler Then, the program running would be doing nothing other than producing output that contained the program's source-code I don't understand your question, as it stands. The effort would be pointless - an act of 'because I can'
-
Thanks for immediate reeply for example... my program coding is..
#include
#include
void main()
{
float n1,n2,ans;
}And the program output should be.... #include #include void main() { float n1,n2,ans; } how to achieve it? thanks in advance
Ahhhh.... I was afraid you were going to say that or words to that effect. What you're looking for is a decompiler or a dissasembler. The difference is in the 'high-level'ness of their output. A dissasembler will turn a piece of executable code into an assembly listing. A decompiler on the other hand, will produce C (or most any other high level language within reason) code from an executable. While it is true that a fairly large number of people have written dissasemblers, the same can't be said for decompilers. It is a notoriously difficult & complex subject. HexRays has a product that will turn an exe file into C source code - it is the $2000 plugin for IDA Pro interactive dissasembler. You can find more info on HexRays here (they have a free version of IDAPro) http://www.hex-rays.com/products.shtml[^] Also, here are some links to decompilers/dissasemblers that people have coded themselves: http://www.woodmann.com/collaborative/tools/index.php/Category:Decompilers[^] http://www.woodmann.com/collaborative/tools/index.php/Category:Disassemblers[^] 'luck.
-
Ahhhh.... I was afraid you were going to say that or words to that effect. What you're looking for is a decompiler or a dissasembler. The difference is in the 'high-level'ness of their output. A dissasembler will turn a piece of executable code into an assembly listing. A decompiler on the other hand, will produce C (or most any other high level language within reason) code from an executable. While it is true that a fairly large number of people have written dissasemblers, the same can't be said for decompilers. It is a notoriously difficult & complex subject. HexRays has a product that will turn an exe file into C source code - it is the $2000 plugin for IDA Pro interactive dissasembler. You can find more info on HexRays here (they have a free version of IDAPro) http://www.hex-rays.com/products.shtml[^] Also, here are some links to decompilers/dissasemblers that people have coded themselves: http://www.woodmann.com/collaborative/tools/index.php/Category:Decompilers[^] http://www.woodmann.com/collaborative/tools/index.php/Category:Disassemblers[^] 'luck.
-
thanks for your reply. whether this can be achieve in .net easily? or someother language?
Pleasure. In every case I can immediately think of, these tools are compiled to native code. This of course implies the use of C/C++, asm & pascal though I've no idea if anything .NET would be suitable or not - I would assume it to be possible, albeit slow in execution on account of the code being interpreted at runtime. Lutz Roeder's .NET Reflector will give you the source code of a .NET executable. The Deblector & Reflexil plugins are invaluable - HOWEVER these are all only available as binaries, so of very little to no interest to somebody trying to create a tool that achieves the same task.
-
Pleasure. In every case I can immediately think of, these tools are compiled to native code. This of course implies the use of C/C++, asm & pascal though I've no idea if anything .NET would be suitable or not - I would assume it to be possible, albeit slow in execution on account of the code being interpreted at runtime. Lutz Roeder's .NET Reflector will give you the source code of a .NET executable. The Deblector & Reflexil plugins are invaluable - HOWEVER these are all only available as binaries, so of very little to no interest to somebody trying to create a tool that achieves the same task.
-
hai, i would like to display the coding. Means, while i m running my C/C++ program the output should be of the program coding which i m execting..... how can i do it? Help me! Thanks for understanding!!!
The program that reproduces its own source as output is called quine (After American logician Willard Van Orman Quine). There are many ways to do it, but rather than I give you a complete working example, I'd appreciate if you google for quine and go through the results. :)
It's better to know some of the questions than all of the answers.
Pravin.