}
Abstract—Abstract: In this article you will find a small
induction management C compiler in Linux and Windows The first thing we do, is to look for libraries that have the
Operating Systems operations included in the program, then we add brackets in
Index Terms—Compiling ,executing, C Language.
order to obtain expressions syntactically consistent and finally
we use an operation that allows us to keep the program
I. INTRODUCTION running until you press a key, with so that the program does
not end up alone.
T he C language is a very powerful tool, mainly oriented
towards operating systems, this paper will show some
We obtain:
#include <stdio.h>
basic keys to handle files written in this language from Linux #include <stdlib.h>
and Windows. int main(int argc, char *argv[])
Step by step. {
A.Step # 1 Create a file. C and compile it, int i;
The first thing to do is open the Vi text editor and create a for (i = 0; i < argc; i++){
xxx.c Where Xxx is the file name. printf("%s\n",argv[i]);
To compile it, we use the command } getchar();
gcc-c return EXIT_SUCCESS;
and below it the name of the file: }
gcc-c xxx.c
Later, you get a file is a file xxx.o object and invoke it using C. Step #3 What’s this about arguments?
gcc xxx.o
Case Generates a file called In Windows development environment using edit the
previous program. We Configure the development
"a.out"
environment to add the arguments to run.
To generate the executable file and give it a name, you enter
Passing parameters in C is by value, but you can simulate a
the decision:
call by reference using a pointer as an argument.
gcc-o xxx_runnable xxx.c This formal argument having the form:
type_i * arg_i, and when making the call, the actual
B. Step # 2 Correction of the file. parameter has the format: & param.
So, main () is the main function of the program, and
After creating a file in C, now let's try to compile this using parameters can be passed to any other function, as it is only
the instructions as mentioned in the previous step. the first function that is called within a program. Passing
Initially, the file "Lab1.c" was described as follows: parameters can be made from the shell or from the system
#include call which executes a new program using exec.
#include This uses two predefined special arguments: argc and argv.
int main(int argc, char *argv) The parameter argc is an integer that contains the number of
int i; arguments in the command line. It always has a minimum
printf("Numero de argumentos = %d\n",argc); value of 1, as also recorded the program name as a parameter.
for (i = 0; i < argc; i++) Whenever we use the value of a parameter passed to main, to
printf("Argumento %d = %s\n", i, argv[i]); verify the value of argc.
The parameter argv is a vector of pointers to characters.
return EXIT_SUCCESS;
Character pointers point to strings that contain the arguments
that are passed on the command line.
2
#include <stdio.h>
#include <stdlib.h>
int main()
{
system("notepad");
system("pause");
return EXIT_SUCCESS;
}
II. CONCLUSION