Get input in c as a password field:(*****)

[** only for windows users]]

#include <stdio.h>
#include <string.h>

int main()
char word1[8]=”shadhin”;
char word2[8];
char c;
int i=0;



if(strcmp(word1,word2) == 0)
printf(“nPassword is correct”);
printf(“nPassword is incorrect”);

How to Cross Compiling with codeblocks using linux

The following is how I did this on Ubuntu ‘Precise Pangolin’ Linux:

Step 1:

Install MingW32 for linux

# sudo apt-get install mingw32

Step 2:

Settings->Compiler and debugger settings

 Select GNU GCC Compiler and click the Copy button.
 Name this: MingW32 Compiler

Step 3:

Click the Compiler tab and then click the #defines tab.
Add the following:


Click the Linker tab and the following under “Other Linker Options”:


*Note: Not all of these are REQUIRED… As I have been recently messing with compiling apps for windows with ogl and dx9 support I have realized that there are some additions I have needed to add here… I will update accordingly when I know more.

Step 4:

Click the Directories tab and the Compiler tab.

 Modify the path to read the following (where ix86 is your architecture type):

Click the Directories tab and the Linker tab:

 Modify the path to read the following (where ix86 is your architecture type):

Click the Directories tab and the Resource Compiler tab:

 Modify the path to read the following (where ix86 is your architecture type):

Step 5:

Click the Programs tab:

 C compiler: i586-mingw32msvc-gcc
 C++ compiler: i586-mingw32msvc-g++
 Linker for dynamic libs: i586-mingw32msvc-g++
 Linker for static libs: i586-mingw32msvc-ar
 Debugger: i586-mingw32msvc-gdb    **** MORE ON THIS LATER ****

Click OK and save your changes.

Step 6:

Ubuntu’s mingw32 package and from what I can tell, MingW32 in general doesnt really have a solid gdb option for debugging natively in linux so we’re going to work around this using wine and mingw32’s latest insight build for windows

Install Wine


# sudo apt-get install wine

Step 7:

Download Insight here:


Step 8:

Once you download insight.exe, extract the archive using wine:

wine insight.exe

I extracted this to my desktop

Step 9:

Move the insight folder to /opt

the path should now look like


Step 10:

create a shell script in /usr/bin:

(note: shell scripts should start with a hash (#) bang (!), ie: “# ! / bin / sh ” [with no spaces] but when I add that the forum post tanks)

# sudo gedit /usr/bin/i586-mingw32msvc-gdb

and add the following:

wine /opt/insight/bin/gdb.exe "$@"

Save the file and quit gedit

Step 11:

# sudo chmod +x /usr/bin/i586-mingw32msvc-gdb

Now we have a way to execute the windows version of mingw32’s gdb for windows in linux using our shell script wrapper

Step 12:

Create a new console application project in Codeblocks…

Using the wizard select the MingW32 Compiler option.

Step 13:

Right click the project and go to properties. Click the Targets tab and set the Output Filename to be whatever you want with a .exe file extension. Make sure the Type is a Console Application.

Step 14:

Hit F9 in codeblocks and the hello world application runs!! YAY!

Set a breakpoint on line 5 and hit F8 and the application breaks in the debugger!! Woot!

Now you can successfully compile, execute, and debug windows applications in linux using codeblocks!!!

Source post:  Click here

(C/C++) How to make windows executable file(.exe) from GNU/Linux

To make windows executable file(.exe) from GNU/Linux you need a Cross-Compiler named ” mingw32

  • Installation

If you using Ubuntu  then install “mingw32".You can install it many ways but if you are lazy as like me then you can use terminal.Give this command on terminal.

sudo  apt-get  install  mingw32

Replace “apt-get” with “yum” or whatever your linux distro uses.


To compile C  source code give below command on terminal

i586-mingw32msvc-cc  main.c  -o  main.exe

here main.c is your c source file and main.exe is you desire .exe file name.

To compile C ++  source code give below command on terminal

i586-mingw32msvc-c++  clock.cpp  -o  clock.exe

here clock.cpp  is your c++ source file and clock.exe is you desire .exe file name.

Now you can run those main.exe and clock.exe on Windows OS. if you want to run those .exe file on linux you need wine or  other software that can run windows executable file. I prefer to use wine its  free.

to install wine on Ubuntu give this command on terminal

sudo  apt-get  install  wine

Replace “apt-get” with “yum” or whatever your linux distro uses.

now type on terminal

wine  main.exe


C Program Without a Main Function


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…

#define HRS(f,a,c,e,b,o,Q,k) f##b##Q##k
#define shadhin HRS(m,r,s,h,a,d,i,n)

//HRS = Habibur Rahman Shadhin

int shadhin()
        printf(“”Shadhin” Awesome!!!!!!!!!!!!!!”);

Does the above program run without the main function? Yes, the above program runs perfectly fine even without a main function. But how, whats the logic behind it? How can we have a C program working without main?

Here we are using preprocessor directive #define with arguments to give an impression that the program runs without main. But in reality it runs with a hidden main function.

The ‘##‘ operator is called the token pasting or token merging operator. That is we can merge two or more characters with it.

ψ NOTE: A Preprocessor is program which processes the source code before compilation.

Look at the 2nd line of program –

#define HRS(f,a,c,e,b,o,Q,k) f##b##Q##k

What is the preprocessor doing here. The macro HRS(f,a,c,e,b,o,Q,k) is being expanded as “fbQk” (The ## operator merges f,b,Q&k into fbQk). The logic is when you pass (f,a,c,e,b,o,Q,k)as argument it merges the 1st,5th,7th& the 8th characters(tokens).

Now look at the third line of the program –

#define shadhin HRS(m,r,s,h,a,d,i,n)

Here the preprocessor replaces the macro “begin” with the expansion HRS(m,r,s,h,a,d,i,n). According to the macro definition in the previous line the argument must be expanded so that the 1st,5th,7th& the 8th characters must be merged. In the argument (m,r,s,h,a,d,i,n)  1st,5th,7th& the 8th characters are ‘m’,’a’,’i’ & ‘n’.

So the third line “int shadhin” is replaced by “int main” by the preprocessor before the program is passed on for the compiler. That’s it…

The bottom line is there can never exist a C program without a main function. Here we are just playing a gimmick that makes us beleive the program runs without main function, but actually there exists a hidden main function in the program. Here we are using the proprocessor directive to intelligently replace the word begin” by “main”. In simple words int shadin=int main.


Language: C++

#include <stdlib.h>
void welcome(void);
void thanks(void);
using namespace std;
int main()
char file;
char s;
printf(“Are you sure to run this? Y/Nn”);

ifstream shadhin(“links.txt”);
char link[5000];
if(file==’y’ || file==’Y’)
cout<<“nn”links.txt” file missing.!!! First close the progarm then Put the file and run again.n”;
cout<<“Press CTRL+Z then Enter to exit.”<<endl;
return 0;
cout<<“nProgram is now runnig…………………..”<<endl;
ShellExecute(NULL, “open”, link,
cout<<“nWork is done.”;
}else if(file==’n’ || file==’N’){
cout<<“nThank you! Best of luck for next time.n”<<endl;
cout<<“Oops!!!!!! You enter invalid key.Run again and give right key.”<<endl;
cout<<“Press CTRL+Z then Enter to exit.”<<endl;

return 0;

void welcome(void)
cout<<“Welcome!This is an auto urls opener program that Developed by H.R.Shadhin”<<endl;
void thanks(void)
cout<<“Thank you for using this program.”<<endl;
cout<<“Give feedbacks on:”<<endl;
cout<<“E-mail:dev[AT]hrshadhin[DOT]me “<<endl;

Auto url Opener

                                      “url opener”                                                  
This is a simple program that read urls from a text file and open urls on Default Browser.IF text file contains many urls its automatically open these on browser 5 sec later each one.

_________ _        _______  _______
                 __   __/( (    /|(  ____ (  ___  )
                    ) (   |    ( || (    /| (   ) |
                    | |   |   | || (__    | |   | |
                    | |   | ( ) ||  __)   | |   | |
                    | |   | |    || (      | |   | |
                 ___) (___| )    || )      | (___) |
                 _______/|/    )_)|/       (_______)

                        Name: Url Opener
                        OS : windows xp,vista,7
Download : click here