TilesetEditor::TilesetEditor(QWidget *parent) : QDialog(parent) { setWindowTitle(tr("Tileset Editor")); // Create GUI Items _new_pbut = new QPushButton(tr("New"), this); _open_pbut = new QPushButton(tr("Open"), this); _save_pbut = new QPushButton(tr("Save"), this); _exit_pbut = new QPushButton(tr("Exit"), this); _exit_pbut->setDefault(true); // Create the window _tset_display = new TilesetDisplay; _tset_display->resize(512, 512); _tset_display->setFixedWidth(512); _tset_display->setFixedHeight(512); // connect button signals connect(_new_pbut, SIGNAL(clicked()), this, SLOT(_NewFile())); connect(_open_pbut, SIGNAL(clicked()), this, SLOT(_OpenFile())); connect(_save_pbut, SIGNAL(clicked()), this, SLOT(_SaveFile())); connect(_exit_pbut, SIGNAL(released()), this, SLOT(reject())); // Add all of the aforementioned widgets into a nice-looking grid layout _dia_layout = new QGridLayout(this); _dia_layout->addWidget(_new_pbut, 0, 1); _dia_layout->addWidget(_open_pbut, 1, 1); _dia_layout->addWidget(_save_pbut, 2, 1); _dia_layout->addWidget(_exit_pbut, 3, 1); _dia_layout->addWidget(_tset_display, 0, 0, 3, 1); }
/*static*/ status_t FSUtils::CompareFileContent(const Entry& entry1, const Entry& entry2, bool& _equal) { BFile file1; status_t error = _OpenFile(entry1, file1); if (error != B_OK) return error; BFile file2; error = _OpenFile(entry2, file2); if (error != B_OK) return error; return CompareFileContent(file1, file2, _equal); }
void GDocApp<OptionsFmt>::OnReceiveFiles(GArray<char*> &Files) { char *f = Files.Length() ? Files[0] : 0; if (f && _OpenFile(f, false)) { GMru::AddFile(f); } }
void main(int argc,char **argv) { int n = 0; int fd; char *path; char buf[BUFSIZ]; if(argc != 2){ printf("invalid argument!\n"); exit(1); } path = argv[1]; fd = _OpenFile(path,O_RDONLY); printf("readfile fd -- %d\n",fd); if(fd != -1){ bzero(buf,BUFSIZ); n = _ReadFile(fd,buf,BUFSIZ,0); printf("read -- %s\n",buf); _CloseFile(fd); } exit(0); }
int WOggDecoder::OpenStream(WQueue *pQueue, int fDynamic, int param1, int param2) { err(DECODER_NO_ERROR); c_Queue = pQueue; unsigned int nSize = pQueue->GetSizeSum(); if(nSize == 0) { err(DECODER_NOT_VALID_OGG_STREAM); return 0; } unsigned char *ptr; unsigned int size; if(pQueue->QueryFirstPointer((void**) &ptr, &size) == 0) { err(DECODER_NOT_VALID_OGG_STREAM); return 0; } c_fManagedStream = 0; cb.read_func = read_func; cb.close_func = close_func; cb.seek_func = seek_func; cb.tell_func = tell_func; if(param1 == 0) { c_pchStreamStart = ptr; c_nStreamSize = size; c_pchStreamEnd = c_pchStreamStart + c_nStreamSize - 1; if(fDynamic) { c_fManagedStream = 1; cb.read_func = managed_read_func; cb.close_func = NULL; cb.seek_func = NULL; cb.tell_func = NULL; } if(_OpenFile(0) == 0) { Close(); return 0; } return 1; } else { c_pchStreamStart = ptr; c_nStreamSize = size; c_pchStreamEnd = c_pchStreamStart + c_nStreamSize - 1; if(_OpenFile(1) == 0) { Close(); return 0; } return 1; } return 0; }