Пример #1
0
void imBinSystemFileHandle::New(const char* pFileName)
{
  // the file was successfully opened already the client 

  HANDLE file_handle = (HANDLE)pFileName;
  this->FileHandle = file_handle;
  SetByteOrder(imBinCPUByteOrder());
  this->IsNew = 1;
  this->Error = 0;
}
Пример #2
0
void imBinSystemFileHandle::New(const char* pFileName)
{
  // the file was successfully opened already the client

  int *s = (int*)pFileName;
  this->FileHandle = s[0];
  SetByteOrder(imBinCPUByteOrder());
  this->IsNew = 1;
  this->Error = 0;
}
Пример #3
0
void imBinSystemFile::New(const char* pFileName)
{
  this->FileHandle = CreateFile(pFileName, GENERIC_READ | GENERIC_WRITE, 
                                           0, 
                                           NULL, 
                                           CREATE_ALWAYS,
                                           FILE_ATTRIBUTE_NORMAL,
                                           NULL);
  this->Error = (this->FileHandle == INVALID_HANDLE_VALUE)? 1: 0;
  SetLastError(NO_ERROR);
  SetByteOrder(imBinCPUByteOrder());
  this->IsNew = 1;
}
Пример #4
0
void imBinSystemFile::Open(const char* pFileName)
{
  this->FileHandle = CreateFile(pFileName, GENERIC_READ, 
                                           FILE_SHARE_READ, 
                                           NULL, 
                                           OPEN_EXISTING,
                                           FILE_ATTRIBUTE_NORMAL,
                                           NULL);
  this->Error = (this->FileHandle == INVALID_HANDLE_VALUE)? 1: 0;
  SetLastError(NO_ERROR);
  SetByteOrder(imBinCPUByteOrder());
  this->IsNew = 0;
}
Пример #5
0
void imBinSystemFile::New(const char* pFileName)
{
  int mode = O_WRONLY | O_CREAT | O_TRUNC;           
#ifdef O_BINARY
    mode |= O_BINARY;
#endif        
  this->FileHandle = open(pFileName, mode, 0666); // User/Group/Other can read and write
  if (this->FileHandle < 0) 
    this->Error = errno;
  else
    this->Error = 0;
  SetByteOrder(imBinCPUByteOrder());
  this->IsNew = 1;
}
Пример #6
0
void imBinSystemFile::Open(const char* pFileName)
{
  int mode = O_RDONLY;
#ifdef O_BINARY
    mode |= O_BINARY;
#endif        
  this->FileHandle = open(pFileName, mode, 0);
  if (this->FileHandle < 0) 
    this->Error = errno;
  else
    this->Error = 0;
  SetByteOrder(imBinCPUByteOrder());
  this->IsNew = 0;
}
Пример #7
0
void imBinMemoryFile::Open(const char* pFileName)
{
    this->file_name = (imBinMemoryFileName*)pFileName;

    SetByteOrder(imBinCPUByteOrder());
    this->IsNew = 0;

    assert(this->file_name->size);

    this->Buffer = this->file_name->buffer;
    this->BufferSize = this->file_name->size;
    this->Reallocate = this->file_name->reallocate;
    this->CurrentSize = this->BufferSize;
    this->CurPos = this->Buffer;
    this->Error = 0;
}
Пример #8
0
void imBinMemoryFile::New(const char* pFileName)
{
    this->file_name = (imBinMemoryFileName*)pFileName;

    SetByteOrder(imBinCPUByteOrder());
    this->IsNew = 1;

    assert(this->file_name->size);

    this->Buffer = this->file_name->buffer;
    this->BufferSize = this->file_name->size;
    this->Reallocate = this->file_name->reallocate;
    this->CurrentSize = 0;

    if (!this->Buffer)
    {
        this->Buffer = (unsigned char*)malloc(this->BufferSize);
        this->file_name->buffer = this->Buffer;
    }

    this->CurPos = this->Buffer;
    this->Error = 0;
}
Пример #9
0
void imBinStreamFile::New(const char* pFileName)
{
    this->FileHandle = fopen(pFileName, "wb");
    SetByteOrder(imBinCPUByteOrder());
    this->IsNew = 1;
}