#include <stdlib.h>
#include "error_management.h"
#include "format_data.h"
Go to the source code of this file.
Functions | |
void | format_data (char *_path, char *_pattern, int n_arg) |
int | main (int argc, char *argv[]) |
void format_data | ( | char * | _path, | |
char * | _pattern, | |||
int | n_arg | |||
) |
Definition at line 35 of file UTILS/PROGRAMS/WINDOWS/DATA_EXTRACT/main.c.
References _data, ASSERT, format_data_get_data(), and n_data.
Referenced by main().
00036 { 00037 char *_buffer; 00038 int n, n_data; 00039 FILE *_file; 00040 float *_data; 00041 00042 ASSERT(_path); 00043 00044 // Open the file 00045 _file = fopen(_path, "rb"); 00046 ASSERT(_file); 00047 // Get the length of the file and store it into n 00048 fseek(_file, 0, SEEK_END); 00049 n = ftell(_file); 00050 // allocate a buffer of the size of the file 00051 _buffer = (char *) malloc(n + 1); 00052 ASSERT(_buffer); 00053 _buffer[n] = '\0'; 00054 // Go to the beginning of the file 00055 fseek(_file, 0, SEEK_SET); 00056 // Read it 00057 fread(_buffer, 1, n, _file); 00058 fclose(_file); 00059 00060 // Extract data from a buffer 00061 n_data = format_data_get_data(_buffer, _pattern, n_arg); 00062 00063 free(_buffer); 00064 }
int main | ( | int | argc, | |
char * | argv[] | |||
) |
Definition at line 67 of file UTILS/PROGRAMS/WINDOWS/DATA_EXTRACT/main.c.
References format_data().
00068 { 00069 00070 // If there arguments passed to this program 00071 if (argc == 4) 00072 format_data(argv[1], argv[2], atoi(argv[3])); 00073 // Else print the usage 00074 else 00075 printf("Usage: DataExtract input_buffer_file_path pattern n_arg\n\r"); 00076 00077 return 0; 00078 }