Hi All,
I need to write a program that will print source code of its source file.
Assume that after building the binary i will delete the source file.
Thanks,
Akshobhya
5 2388
Hi All,
I need to write a program that will print source code of its source file.
Assume that after building the binary i will delete the source file.
Thanks,
Akshobhya
Hi Akshobhya,
This may satisfy your need. -
-
#include <stdio.h>
-
char *program = "#include <stdio.h>%cchar *program = %c%s%c;%cint main()%c{%c%cprintf(program, 10, 34, program, 34, 10, 10, 10, 9, 10, 9, 10, 10,10);%c%creturn 0;%c}%c";
-
int main()
-
{
-
printf(program, 10, 34, program, 34, 10, 10, 10, 9, 10, 9, 10, 10,10);
-
return 0;
-
}
-
-
-
Regards,
M.Sivadhas.
Hi Akshobhya,
This may satisfy your need. -
-
#include <stdio.h>
-
char *program = "#include <stdio.h>%cchar *program = %c%s%c;%cint main()%c{%c%cprintf(program, 10, 34, program, 34, 10, 10, 10, 9, 10, 9, 10, 10,10);%c%creturn 0;%c}%c";
-
int main()
-
{
-
printf(program, 10, 34, program, 34, 10, 10, 10, 9, 10, 9, 10, 10,10);
-
return 0;
-
}
-
-
-
Regards,
M.Sivadhas.
Hi Sivadhas,
Thank you very much its very good interesting programming skill.
Send me such puzzles if you find some time.
Thanks,
Aks
Hi Sivadhas,
Thank you very much its very good interesting programming skill.
Send me such puzzles if you find some time.
Thanks,
Aks
would some one please explain me this program and its process (to print the source code)?
would some one please explain me this program and its process (to print the source code)?
The source is included in the printf statements.
Yes.. good... you guys know of any dynamic approach using just GNU library.. C perhaps..
Sign in to post your reply or Sign up for a free account.
Similar topics
by: sonu |
last post by:
I have following client side code which i have used in my asp.net
project
SummaryFeatured Resources from the
IBM Business Values Solution Center
WHITEPAPER :
CRM Done Right
Improve the...
|
by: Lucas |
last post by:
I need print a file in binary mode .
f = f.open('python.jpg','rb')
bytes = f.read()
f.close()
print(bytes)
I can't get any binary code.
|
by: waterdriven |
last post by:
Hello;
I am a newbie.
A homework assignment was assigned and I am having trouble getting started.
The assignment reads:
Write a program to print out the binary value of a 16 bit number.
|
by: Sin Jeong-hun |
last post by:
It looked like that I can print a number in hexadecimal format with
Console.Write, but I couldn't find how to print in binary format. I
mean 000...0001 for 1, 000...0010 for 2 and so on.
I wrote...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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: 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...
| |