The qDecoder Project

qCount.c File Reference

Counter File Handling API. More…


Functions

int qCountRead (const char *filepath)
 Read counter(integer) from file with advisory file locking.
bool qCountSave (const char *filepath, int number)
 Save counter(integer) to file with advisory file locking.
int qCountUpdate (const char *filepath, int number)
 Increases(or decrease) the counter value as much as specified number with advisory file locking.


Detailed Description

Counter File Handling API.

Read/Write/Update counter file like below.

   ---- number.dat ----
   74
   --------------------

Function Documentation

int qCountRead ( const char *  filepath  ) 

Read counter(integer) from file with advisory file locking.

Parameters:
filepath file path
Returns:
counter value readed from file. in case of failure, returns 0.
Note:
   int count;
   count = qCountRead("number.dat");

bool qCountSave ( const char *  filepath,
int  number 
)

Save counter(integer) to file with advisory file locking.

Parameters:
filepath file path
number counter integer value
Returns:
in case of success, returns true. otherwise false.
Note:
   qCountSave("number.dat", 75);

int qCountUpdate ( const char *  filepath,
int  number 
)

Increases(or decrease) the counter value as much as specified number with advisory file locking.

Parameters:
filepath file path
number how much increase or decrease
Returns:
updated counter value. in case of failure, returns 0.
Note:
   int count;
   count = qCountUpdate("number.dat", -3);


[Home] [About] [Examples] [Changes] [Download] [SVN Repository] [Install] [Reference]