Skip to content

Commit

Permalink
Update main.c
Browse files Browse the repository at this point in the history
Adicionado argumentos de linha de comando.
  • Loading branch information
felipefrm committed Jul 20, 2018
1 parent 24cafe0 commit 3a7ecae
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#define N 51

int main(void){
int main(int argc, char **argv){

char num[N], num_convert[N], numX[N]; // Variavies necessárias
int b_origem, b_destino, num_digitos, num_char[N], i, j, k, baseX;
Expand All @@ -15,14 +15,14 @@ int main(void){
unsigned long long int inteira;

FILE *arq_out;
arq_out = fopen("arquivo_saida", "w");
arq_out = fopen(argv[2], "w");
if (arq_out == NULL){
fprintf(stderr, "Erro na abertura do arquivo.\n");
exit(1);
}

FILE *arq_bX;
arq_bX = fopen("arquivo_baseX", "r");
arq_bX = fopen(argv[1], "r");
if (arq_bX == NULL){
fprintf(stderr, "Erro na abertura do arquivo.\n");
exit(1);
Expand Down Expand Up @@ -144,4 +144,5 @@ int main(void){
}
}
fclose(arq_out);
return 0;
}

0 comments on commit 3a7ecae

Please sign in to comment.