15.04.2014 - Version 0.3.8_beta, last version of 0.3.8 branch. Too much added and fixed...

This commit is contained in:
peri4
2014-04-15 13:19:07 +04:00
parent f50891b376
commit 77abb0bbea
46 changed files with 4538 additions and 2515 deletions

View File

@@ -42,19 +42,27 @@
bool PIFile::openDevice() {
if (opened_) close();
close();
if (path_.isEmpty()) return false;
//cout << "fopen " << path_.data() << ": " << strType(mode_).data() << endl;
//piCout << "fopen " << path_.data() << ": " << strType(mode_).data() << fd;
fd = fopen(path_.data(), strType(mode_).data());
opened_ = (fd != 0);
#ifndef WINDOWS
if (opened_) fcntl(fileno(fd), F_SETFL, O_NONBLOCK);
#endif
seekToBegin();
//piCout << "open file" << fd << opened_;
return opened_;
}
bool PIFile::closeDevice() {
//piCout << "close file" << fd << opened_;
if (!opened_ || fd == 0) return true;
return (fclose(fd) == 0);
bool cs = (fclose(fd) == 0);
if (cs) fd = 0;
//piCout << "closed file" << fd << opened_;
return cs;
}