Add ini.h, extra win32 functions, clean up formats

This commit is contained in:
Doyle Thai 2017-04-15 01:27:11 +10:00
parent e0cae3029d
commit f066d8bc4e
2 changed files with 1345 additions and 197 deletions

1508
dqn.h

File diff suppressed because it is too large Load Diff

View File

@ -730,18 +730,34 @@ void dqn_file_test()
{
// File i/o
{
DqnFile file = {};
DQN_ASSERT(dqn_file_open(".clang-format", &file));
DQN_ASSERT(file.size == 1320);
{
DqnFile file = {};
DQN_ASSERT(dqn_file_open(
".clang-format", &file,
(dqnfilepermissionflag_write | dqnfilepermissionflag_read),
dqnfileaction_open_only));
DQN_ASSERT(file.size == 1320);
u8 *buffer = (u8 *)calloc(1, (size_t)file.size * sizeof(u8));
DQN_ASSERT(dqn_file_read(file, buffer, (u32)file.size) == file.size);
free(buffer);
u8 *buffer = (u8 *)calloc(1, (size_t)file.size * sizeof(u8));
DQN_ASSERT(dqn_file_read(file, buffer, (u32)file.size) == file.size);
free(buffer);
dqn_file_close(&file);
DQN_ASSERT(!file.handle && file.size == 0);
dqn_file_close(&file);
DQN_ASSERT(!file.handle && file.size == 0 &&
file.permissionFlags == 0);
}
printf("dqn_file_test(): file_io: Completed successfully\n");
{
DqnFile file = {};
DQN_ASSERT(!dqn_file_open(
"asdljasdnel;kajdf", &file,
(dqnfilepermissionflag_write | dqnfilepermissionflag_read),
dqnfileaction_open_only));
DQN_ASSERT(file.size == 0);
DQN_ASSERT(file.permissionFlags == 0);
DQN_ASSERT(!file.handle);
printf("dqn_file_test(): file_io: Completed successfully\n");
}
}
{