First pass VN
This commit is contained in:
@@ -22,13 +22,17 @@ bool_t File::open(enum FileMode mode) {
|
||||
|
||||
if(this->file == NULL) return false;
|
||||
|
||||
fseek(this->file, 0, SEEK_END);
|
||||
this->length = ftell(this->file);
|
||||
fseek(this->file, 0, SEEK_SET);
|
||||
if(mode == FILE_MODE_READ) {
|
||||
fseek(this->file, 0, SEEK_END);
|
||||
this->length = ftell(this->file);
|
||||
fseek(this->file, 0, SEEK_SET);
|
||||
|
||||
if(this->length <= 0) {
|
||||
this->close();
|
||||
return false;
|
||||
if(this->length <= 0) {
|
||||
this->close();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
this->length = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -80,7 +84,7 @@ bool_t File::writeString(std::string in) {
|
||||
|
||||
const char_t *strOut = in.c_str();
|
||||
// TODO: Validate write length.
|
||||
fwrite(strOut, sizeof(char_t), in.size(), this->file);
|
||||
this->length = fwrite(strOut, sizeof(char_t), in.size(), this->file);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user