
Dot2comma
1. Descrição
Programa em linguagem C, que substitui ponto por vírgula em figuras EPS. Recomendado para adequar figuras de dissertações e monogafias às normas da ABNT que prevê a vírgula como separador decimal nos gráficos.
2. Download
Click aqui para baixar o programa Dot2comma.
3. Documentação
Não há documentação disponível para o Dot2comma. Veja a função main() abaixo.
// AUTHOR: Rodrigo Frehse Pereira
// COMPILATION: gcc dot2comma.c -Wall -lm -o dot2comma.x
// USAGE: ./dot2comma.x name_of_file.ps(.eps)
FILE *input;
FILE *output;
int main(int argc, char *argv[])
{
char get;
char input_file[200], output_file[200];
int inside,count_replace;
void credits(),final_verbose();
int validation();
// Credits on screen and sintax validation.
credits();
validation(argc,argv);
// Create filename strings: "input_file" and "output_file"
sprintf(input_file, "%s", argv[1]);
sprintf(output_file, "%s.old", argv[1]);
if( ((input = fopen(input_file, "r"))==NULL) ||
((output = fopen(output_file, "w"))==NULL) )
printf("Unable to read from '%s' or write over '%s' - Aborting...\n",
input_file, output_file);
else
{ // Main code...
// Backuping to .old file. Copy input file to output file.
while(fscanf(input, "%c", &get)!=EOF)
fprintf(output, "%c", get);
fclose(input);
fclose(output);
// Reverse input/output file descriptors. So on, read from backup
(.old) and write over original input file
input = fopen(output_file, "r");
output = fopen(input_file, "w");
rewind(input);
// While block statement: loops over backup (.old) file
contents, reading it byte-by-byte
inside = 0; count_replace=0;
while(fscanf(input, "%c", &get)!=EOF)
{
// Check if inside parenthesis environment "( )"
if( (get=='(') && (inside==0) )
inside = 1;
else if(get==')')
inside = 0;
// If dot is found inside parenthesis environment "( )"
replace it to comma.
// Write over original input file (it's not .old backup file!)
if( (inside) && (get=='.') ){
fprintf(output, ",");
++count_replace;// replacement counter
}
else
fprintf(output, "%c", get);
}
fclose(input);
fclose(output);
}
final_verbose(input_file,output_file, count_replace);
return 0;
}
//syntax highlighted by Code2HTML, v. 0.9.1
4. Agradecimentos
Agredecemos a todos que de alguma forma contribuiram para este projeto e em particular a:
Fabio M. Zanetti


Início
Mapa do Site
Projetos - Status
Sugestões e Críticas
Fórum FISUX
Seção de Dicas
Seção de Tutoriais
Seção de Software
Seção de FAQ Linux
Exercícios Resolvidos
Seção de Blogs
Suporte Linux
Suporte Programação
Suporte WEB
Galeria de Fotos
Notícias Ciência
Deixe Seu Comentário