RAM usage reading from /proc/meminfo
This commit is contained in:
@@ -221,9 +221,12 @@ void p_free(void *ptr)
|
||||
bool p_file_init(p_file *file, const char *filename, b32 flags)
|
||||
{
|
||||
bool create_flag_set = flags & P_FILE_CREATE_IF_NOT_EXISTS;
|
||||
bool readonly = flags & P_FILE_READONLY;
|
||||
|
||||
|
||||
file->handle = fopen(filename, "rb+");
|
||||
const char *mode = "rb+";
|
||||
if(readonly)
|
||||
mode = "rb";
|
||||
file->handle = fopen(filename, mode);
|
||||
if(create_flag_set && file->handle == NULL) // @Robustness: check errno
|
||||
{
|
||||
file->handle = fopen(filename, "wb+");
|
||||
|
||||
Reference in New Issue
Block a user