Logger using local flash memory and creating a new file every start.
Diff: logr.cpp
- Revision:
- 4:85606321b100
- Parent:
- 3:250e9ea5985b
--- a/logr.cpp Wed May 28 07:01:24 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -#include "logr.h" - -Loger::Loger() : local("local") -{ -} - -void Loger::log_open() -{ - mk_path(get_files()); - _loger = fopen(dst, "w"); -} - -void Loger::log_int2(int in1, int in2) -{ - fprintf(_loger,"%d,%d,",in1,in2); - return; -} - -void Loger::log_chr(char save[]) -{ - fprintf(_loger,"%s",save); - log_rn(); -} - -void Loger::log_rn() -{ - fprintf(_loger,"\r\n"); -} - -void Loger::log_close() -{ - fprintf(_loger,"### END FILE ###\r\n"); - fclose(_loger); -} - -int Loger::get_files() -{ - int num=0; - DIR *d = opendir("/local"); // Opens the root directory of the local file system - struct dirent *p; - while((p = readdir(d)) != NULL) - { // Print the names of the files in the local file system - num++; - } - closedir(d); - return num; -} - -void Loger::mk_path(int nmbr) -{ - sprintf(dst,"/local/logg%02d.txt",nmbr); -} -