Archive for the ‘C Programs’ Category

Hey guys, http://learnhacking.in is back with another “Free Ethical Hacking for all”. As our Facebook Fans are very well aware of this event. This is our Fourth Workshop. This time we wanted to make it really big so we are taking it From our site’s fan page to our sites forum so that its reach [...]

File Embedder in C

Posted: 28th July 2010 by Ravi Chopra in C Programs

Some times it is necessary for our compiled project to have it’s supporting files embedded within the EXE module itself so that the supporting files may not be put into a seperate folder and carried along with the project. So here I am presenting you with the source code of the FILE EMBEDDER UTILITY project. [...]

C Program without main function

Posted: 28th July 2010 by Ravi Chopra in C Programs

How to write a C program without a main function?. Is it possible to do that. Yes there can be a C program without a main function. Here’s the code of the program without a main function… #include<stdio.h> #define decode(s,t,u,m,p,e,d) m##s##u##t #define begin decode(a,n,i,m,a,t,e) int begin() { printf(” hello “); } Does the above program [...]

Guessing game in C

Posted: 28th July 2010 by Ravi Chopra in C Programs

This is a small guessing game written in C. In this guessing game you have to guess a number between 0 & 100. You have 8 chances to do that. Every time you guess wrongly the program will give you a hint that your guess is too high or your guess is too low. Based [...]

Self Destructing program in C

Posted: 28th July 2010 by Ravi Chopra in C Programs

This program will destroy itself upon execution. The program will cause the .exe file to be deleted upon execution. That is this program is capable of destroying itself upon execution. Here is the code #include<stdio.h> #include<conio.h> #include<dos.h> void main() { printf(“This program will destroy itself if u press any key!!!\n”); getch(); remove(_argv[0]);/*array of pointers to [...]

C Program to get Current Time

Posted: 28th July 2010 by Ravi Chopra in C Programs

This program reads the current system time and displays it in the form HH:MM:SS #include <stdio.h> #include <dos.h> int main(void) { struct time t; gettime(&t); printf(“The current time is: %2d:%02d:%02d\n”, t.ti_hour, t.ti_min, t.ti_sec); return 0; } People who read this also read:No Related Posts

C Program to display current date

Posted: 28th July 2010 by Ravi Chopra in C Programs

This program will get or read the current system date from the system. It displays Year, Month and Day. #include <dos.h> #include <stdio.h> int main(void) { struct date d; getdate(&d); printf(“The current year is: %d\n”, d.da_year); printf(“The current day is: %d\n”, d.da_day); printf(“The current month is: %d\n”, d.da_mon); return 0; } People who read this [...]

C Program to Set / Change current system date

Posted: 28th July 2010 by Ravi Chopra in C Programs

This program can be used to set or change the system time #include <stdio.h> #include <dos.h> int main(void) { struct time t; gettime(&t); printf(“The current hour is: %d\n”, t.ti_hour); printf(“The current min is: %d\n”, t.ti_min); printf(“The current second is: %d\n”, t.ti_sec); /* Add one to the hour,minute & sec struct element and then call settime [...]

C Program to generate a random number

Posted: 28th July 2010 by Ravi Chopra in C Programs

This is a simple program to generate random numbers. This logic can be used to build a Lotto program or a program to pick Lucky number and so on. Here’s the program OR If it necessary to generate a number between 0 and (num-1) then this program meets the ideal solution #include<stdio.h> #include<stdlib.h> #include<time.h> /* [...]

C Program to accept a password

Posted: 28th July 2010 by Ravi Chopra in C Programs

This is a simple login program in C. While accepting password it masks each character using ‘*’ symbol and display the password in the next line after the user hits Enter key. It also accepts backspaces and acts accordingly. #include<stdio.h> #include<conio.h> char pw[25],ch; int i; void main() { clrscr(); puts(“Enter password”); while(1) { if(i<0) i=0; [...]