You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
442 B
C
27 lines
442 B
C
#include "fs_list.h"
|
|
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
|
|
int fs_list_get( const char* filename )
|
|
{
|
|
FILE* f;
|
|
int pos = 0;
|
|
f = fopen(filename,"r");
|
|
fscanf( f, "%d", &pos );
|
|
fclose(f);
|
|
|
|
return pos;
|
|
}
|
|
void fs_list_set( const char* path, int value )
|
|
{
|
|
char tmp_filename[512];
|
|
snprintf( tmp_filename, 512, "%s.tmp", path );
|
|
FILE* f = fopen(tmp_filename,"w");
|
|
fprintf( f, "%d", value );
|
|
fclose(f);
|
|
rename( tmp_filename, path );
|
|
}
|
|
|
|
|