Nabeel Sabir


Join the forum, it's quick and easy

Nabeel Sabir
Nabeel Sabir
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Command Line Arguments

Go down

Is this help ful?

Command Line Arguments I_vote_lcap100%Command Line Arguments I_vote_rcap 100% 
[ 6 ]
Command Line Arguments I_vote_lcap0%Command Line Arguments I_vote_rcap 0% 
[ 0 ]
 
Total Votes : 6
 
 

Command Line Arguments Empty Command Line Arguments

Post  Admin Mon Mar 08, 2010 2:21 pm

Dear students following i have told some information about Command Line Argument which you must know. Command Line Arguments are used to Associate file types to some specific executable. For example when ever you double clicked on a file with extension .txt, that file automatically opened in Notepad. Have you ever noticed why it is like this..??
This is why because windows has made association of .txt with Notepad. Same .mp3 files are associated with Windows Media Player, that is why when ever you double clicked a .mp3 file it automatically plays in Windows Media Player.
Whats going on behind the scenes?
When you double clicked a file Windows searches the associated Program in its registry information and executes the program by passing a Command Line Argument to that particular application.
What is that Command Line Argument?
The file name which you have double clicked is the Argument passed to that application.

Associating File Types
You have written few programs using Command Line Arguments, but in those programs you need to give the parameter by typing yourself. Now we will associate file types with our program. In this case when ever we double click a File our Program will open it automatically.
There are two ways to associate a file type with you program.
One is to write directly to registry and other is very simple. Open With command.
First compile your program.
For example you have written a program which takes a text file as input and displays it. So we will associate .txt files with out program.
Write click on any .txt file and the choose Open With.... A dialog box will appear asking you to choose the application. Here you have to browse for your application's executable file. Select it and click on OK. Now double click on any .txt file. Windows will automatically run your program and view the file.

Admin
Admin

Posts : 29
Join date : 2010-02-27

https://nabeel.rpg-board.net

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum