📖 generic · 12th TN - English Medium · COMPUTER SCIENCE · Page 268question

Refer installation of MinGW in Annexure -2 · Part 4

Chapter 4: 6 · COMPUTER SCIENCE

the shell (Here it is Command Window). For Example to compile C++ program g++ compiler should be invoked. To do so the following command is used. os.system (‘g++ ’ + < > +‘ -<mode> ’ + < >) where each argument contains os.system :- function system() defined in os module to interact with the operating system g++ :- General compiler to compile C++ program under Windows Operating system.

:- Name of the C++ file along with its path and without extension in string format mode :- To specify input or output mode. Here it is o prefixed with hyphen. :- Name of the executable file without extension in string format For example the command to compile and execute C++ program is given below os.system('g++ ' + + ' -o ' + ) g++ compiler compiles the file and –o (output) send to ‘+’ in os.system() indicates that all strings are concatenated as a single string Therfore give a space after each word for the above argument. For example 'g++ ' + + ' -o ' + Note 12th Computer Chapter - - Importing C++ Programs in Python .

. . . Python getopt module The getopt module of Python helps you to parse (split) command-line options and arguments.

This module provides getopt() method to enable command-line argument parsing. getopt.getopt function This function parses command-line options and parameter list. Following is the syntax for this method − <opts>,<args>=getopt.getopt(argv, options, [ ]) Here is the detail of the parameters − argv − This is the argument list of values to be parsed (splited). In our program the complete command will be passed as a list.

For example c:\pyprg\pali.py -i c:\pyprg\ options − This is string of option letters that the Python program recognize as, for input or for output, with options (like ‘i’ or ‘o’) that followed by a colon (:). Here colon is used to denote the mode. − This contains a list of strings. Argument of Long options should be followed by an equal sign '='.

In our program the C++ file name along with

Related topics

Have a question about this topic?

Get an AI answer grounded in your actual textbook — with the exact page reference.

Ask AI about this topic →