dil : c
// ###########################################################
// author : yasin tasan
// date : 20.3.2012
// brief : flicker testlerinin sonuc dosyalarindan istenilen
// bolgeden data almak için yazildi.
// su anki hali sadece Pinst için dogru calisir.
// Pst ve Psl sonuclari için duzeltilmesi gerekir.
// ###########################################################
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *read_file_pointer;
FILE *write_file_pointer;
char SIZE = 100; // okunan satirlarin tutuldugu array size'i
char read_file_name[] = "test_log_converted_2010_1.txt";
char write_file_name[] = "result.txt";
char array[SIZE];
char value[10];
char i;
char control_string[] = " ";
char control_value = 0;
char complete_array_flag = 0;
char line_number = 0;
char target_line_number = 0;
memset (array, NULL, sizeof(array));
memset (value, NULL, sizeof(value));
read_file_pointer = fopen(read_file_name, "r");
while ( fgets (array , SIZE , read_file_pointer) != NULL) {
line_number++;
if (line_number == 16){
for(i=0; i<3; i++){
control_value = strcspn (array, control_string) + 1;
memset(array,'-', control_value);
}
for(i=0; i<SIZE; i++){
if(array[control_value+i] == ','){
break;
}
value[i]=array[control_value+i];
}
complete_array_flag = 1;
if (complete_array_flag = 1){
break;
}
}
}
fclose(read_file_pointer);
write_file_pointer = fopen(write_file_name, "w");
fputs(value, write_file_pointer);
fclose(write_file_pointer);
return 0;
}