本文整理汇总了C++中closeFile函数的典型用法代码示例。如果您正苦于以下问题:C++ closeFile函数的具体用法?C++ closeFile怎么用?C++ closeFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了closeFile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: closeFile
/*! \brief Close the file, overrides IoInterface::close().
\returns XRV_OK if the file was closed successfully
*/
XsResultValue IoInterfaceFile::close(void) { return closeFile(); }
开发者ID:jiapei100,项目名称:mrpt,代码行数:4,代码来源:iointerfacefile.cpp
示例2: cleanup
cRecPlayer::~cRecPlayer()
{
cleanup();
closeFile();
free(m_recordingFilename);
}
开发者ID:Ne0tr0n,项目名称:vdr-plugin-xvdr,代码行数:6,代码来源:recplayer.c
示例3: closeFile
void EngineRecord::process(const CSAMPLE* pBuffer, const int iBufferSize) {
float recordingStatus = m_pRecReady->get();
if (recordingStatus == RECORD_OFF) {
//qDebug("Setting record flag to: OFF");
if (fileOpen()) {
Event::end("EngineRecord recording");
closeFile(); // Close file and free encoder.
if (m_bCueIsEnabled) {
closeCueFile();
}
emit(isRecording(false, false));
}
} else if (recordingStatus == RECORD_READY) {
// If we are ready for recording, i.e, the output file has been selected, we
// open a new file.
updateFromPreferences(); // Update file location from preferences.
if (openFile()) {
Event::start("EngineRecord recording");
qDebug("Setting record flag to: ON");
m_pRecReady->set(RECORD_ON);
emit(isRecording(true, false)); // will notify the RecordingManager
// Since we just started recording, timeout and clear the metadata.
m_iMetaDataLife = kMetaDataLifeTimeout;
m_pCurrentTrack.reset();
// clean frames couting and get current sample rate.
m_frames = 0;
m_sampleRate = m_pSamplerate->get();
if (m_bCueIsEnabled) {
openCueFile();
m_cueTrack = 0;
}
} else { // Maybe the encoder could not be initialized
qDebug() << "Could not open" << m_fileName << "for writing.";
qDebug("Setting record flag to: OFF");
m_pRecReady->slotSet(RECORD_OFF);
// An error occurred.
emit(isRecording(false, true));
}
} else if (recordingStatus == RECORD_SPLIT_CONTINUE) {
if (fileOpen()) {
closeFile(); // Close file and free encoder.
if (m_bCueIsEnabled) {
closeCueFile();
}
}
updateFromPreferences(); // Update file location from preferences.
if (openFile()) {
qDebug() << "Splitting to a new file: "<< m_fileName;
m_pRecReady->set(RECORD_ON);
emit(isRecording(true, false)); // will notify the RecordingManager
// Since we just started recording, timeout and clear the metadata.
m_iMetaDataLife = kMetaDataLifeTimeout;
m_pCurrentTrack.reset();
// clean frames counting and get current sample rate.
m_frames = 0;
m_sampleRate = m_pSamplerate->get();
m_recordedDuration = 0;
if (m_bCueIsEnabled) {
openCueFile();
m_cueTrack = 0;
}
} else { // Maybe the encoder could not be initialized
qDebug() << "Could not open" << m_fileName << "for writing.";
Event::end("EngineRecord recording");
qDebug("Setting record flag to: OFF");
m_pRecReady->slotSet(RECORD_OFF);
// An error occurred.
emit(isRecording(false, true));
}
}
// Checking again from m_pRecReady since its status might have changed
// in the previous "if" blocks.
if (m_pRecReady->get() == RECORD_ON) {
// Compress audio. Encoder will call method 'write()' below to
// write a file stream and emit bytesRecorded.
m_pEncoder->encodeBuffer(pBuffer, iBufferSize);
//Writing cueLine before updating the time counter since we preffer to be ahead
//rather than late.
if (m_bCueIsEnabled && metaDataHasChanged()) {
m_cueTrack++;
writeCueLine();
m_cueFile.flush();
}
// update frames counting and recorded duration (seconds)
m_frames += iBufferSize / 2;
unsigned long lastDuration = m_recordedDuration;
m_recordedDuration = m_frames / m_sampleRate;
// gets recorded duration and emit signal that will be used
//.........这里部分代码省略.........
开发者ID:DJMaxergy,项目名称:mixxx,代码行数:101,代码来源:enginerecord.cpp
示例4: closeFile
void CardReader::stopPrint() {
sdprinting = false;
closeFile();
}
开发者ID:RicardoGA,项目名称:MarlinKimbra,代码行数:4,代码来源:cardreader.cpp
示例5: closeFile
//---------------------------------------------------//
clFile::~clFile()
{
//- close file
closeFile();
}
开发者ID:JarredPrichard,项目名称:EOS-Formats,代码行数:6,代码来源:clFile.cpp
示例6: onewire_closefile_work_func
static void onewire_closefile_work_func(struct work_struct *work)
{
if(fp)
closeFile(fp);
}
开发者ID:anoane,项目名称:Evita_UL_422-JB,代码行数:5,代码来源:htc_headset_one_wire.c
示例7: closeFile
GraphVizContext::~GraphVizContext()
{
closeFile();
}
开发者ID:601040605,项目名称:WProtect,代码行数:4,代码来源:MemoryManager.cpp
示例8: closeFile
CLogFileWriter::~CLogFileWriter()
{
closeFile();
}
开发者ID:shlusiak,项目名称:Freebloks-3D,代码行数:4,代码来源:logger.cpp
示例9: QObject
/**
* Constructor.
* @param window The main application window.
* @param toolbar The main toolbar
* @param fileDescription The description of the document file type as it is
* to appear in file dialogs
* @param fileExtension The file extension of the document file type (do not
* include the period)
* @param newFileLaunchesDialog True if creating a new file launches a dialog
* to set additional parameters, false otherwise
*/
QQMenuHelper::QQMenuHelper(QMainWindow *window, QToolBar *toolbar,
const QString &fileDescription,
const QString &fileExtension,
bool newFileLaunchesDialog)
: QObject(window), mainWindow(window), mainToolBar(toolbar),
description(fileDescription), extension(fileExtension), file(0), help(0)
{
QChar ellipsis(8230);
// Some phrases need to be handled differently on Mac OS X
QString prefsText = menuText(tr("Pr&eferences"));
QString macPrefsText = QMenuBar::tr("Preferences");
QString quitText = menuText(tr("&Quit"));
QString macQuitText = QMenuBar::tr("Quit %1");
QString helpText = tr("Help Contents");
QString macHelpText = tr("%1 Help").arg(qApp->applicationName());
QString aboutText = menuText(tr("&About %1")).arg(qApp->applicationName());
QString macAboutText = QMenuBar::tr("About %1");
QString aboutQtText = menuText(tr("About &Qt"));
QString macAboutQtText = QMenuBar::tr("About Qt");
#ifdef Q_WS_MAC
prefsText = macPrefsText;
quitText = macQuitText;
helpText = macHelpText;
aboutText = macAboutText;
aboutQtText = macAboutQtText;
#endif
// File menu actions
QString fileNewText(tr("&New"));
if (newFileLaunchesDialog) {
fileNewText += ellipsis;
}
fileNewAction = new QAction(QIcon(":/icons/new.png"), menuText(fileNewText), window);
fileNewAction->setStatusTip(tr("Create a new file"));
fileNewAction->setToolTip(fileNewAction->statusTip());
fileNewAction->setShortcut(QKeySequence::New);
connect(fileNewAction, SIGNAL(triggered()), this, SLOT(emitNewFile()));
fileOpenAction = new QAction(QIcon(":/icons/open.png"), menuText(tr("&Open")) + ellipsis, window);
fileOpenAction->setStatusTip(tr("Open an existing file"));
fileOpenAction->setToolTip(fileOpenAction->statusTip());
fileOpenAction->setShortcut(QKeySequence::Open);
connect(fileOpenAction, SIGNAL(triggered()), this, SLOT(emitOpenFile()));
quitAction = new QAction(QIcon(":/icons/quit.png"), quitText, window);
quitAction->setStatusTip(tr("Quit the application"));
#if !defined(Q_WS_HILDON)
quitAction->setShortcut(QKeySequence::Quit);
#endif
quitAction->setMenuRole(QAction::QuitRole);
connect(quitAction, SIGNAL(triggered()), this, SIGNAL(quit()));
fileSaveAction = new QAction(QIcon(":/icons/save.png"), menuText(tr("&Save")), window);
fileSaveAction->setStatusTip(tr("Save the current file"));
fileSaveAction->setToolTip(fileSaveAction->statusTip());
fileSaveAction->setShortcut(QKeySequence::Save);
connect(fileSaveAction, SIGNAL(triggered()), this, SIGNAL(saveFile()));
for (int i = 0; i < MAX_RECENT_FILES; i++) {
// we'll set the actual paths later; just need actions that stick
// around after a file is opened
recentActions[i] = new QAction("", window);
connect(recentActions[i], SIGNAL(triggered()), this, SLOT(openRecent()));
}
fileSeparatorAction = new QAction(this);
fileSeparatorAction->setSeparator(true);
closeAction = new QAction(QIcon(":/icons/close.png"), menuText(tr("&Close")), window);
closeAction->setStatusTip(tr("Close the current file"));
closeAction->setShortcut(QKeySequence::Close);
connect(closeAction, SIGNAL(triggered()), this, SIGNAL(closeFile()));
prefsAction = new QAction(prefsText, window);
prefsAction->setStatusTip(tr("Change the application settings"));
#if !defined(Q_WS_HILDON)
prefsAction->setShortcut(QKeySequence::Preferences);
#endif
prefsAction->setMenuRole(QAction::PreferencesRole);
connect(prefsAction, SIGNAL(triggered()), this, SIGNAL(editPreferences()));
#if defined(Q_WS_MAC) || defined(Q_WS_HILDON) || defined(Q_WS_MAEMO_5)
fileNewAction->setIconVisibleInMenu(false);
fileOpenAction->setIconVisibleInMenu(false);
quitAction->setIconVisibleInMenu(false);
fileSaveAction->setIconVisibleInMenu(false);
closeAction->setIconVisibleInMenu(false);
#endif
//.........这里部分代码省略.........
开发者ID:jmbowman,项目名称:portabase,代码行数:101,代码来源:qqmenuhelper.cpp
示例10: closeFile
FileWriter::~FileWriter()
{
closeFile();
}
开发者ID:AzanovAA,项目名称:frl,代码行数:4,代码来源:frl_logging_writers.cpp
示例11: main
//.........这里部分代码省略.........
//create our base objects for the university
cout<<"Hiring Faculty..."<<endl;
for(int i = 0; i < facultyCount; i++){
faculty.push_back(Faculty());
}
cout<<"Accepting Student Applications..."<<endl;
for(int i = 0; i < studentCount; i++){
students.push_back(Student());
}
cout<<"Founding Organizations..."<<endl;
for(int i = 0; i < organizationCount; i++){
organizations.push_back(Organization());
}
cout<<"Designing Curriculum..."<<endl;
unordered_set<string> uniqueCourses; //the set stores only unique values and determines duplicates in O(1) time. This is how we keep from regenerating the same class twice
for(int i = 0; i < courseCount; i++){
Class newClass;
string key;
do{
newClass = Class(); //regenerate a class if it already exists
key = newClass.subject + itos(newClass.number);
}while(uniqueCourses.find(key) != uniqueCourses.end()); //loop until we fail to find a course with this key value. then we'll know it's unique
uniqueCourses.insert(uniqueCourses.begin(), key);
courses.push_back(newClass);
}
//create relations between these base objects (a.k.a the hard part).
cout<<"Opening Registration & Open House..."<<endl;
for(int i = 0; i < studentCount; i++){
for(int j = 0; j < (rand() % 20)+1; j++){//average 10 enrollments over the course of 4 semesters
enrollment.push_back(EnrolledIn(students[i]));
}
for(int j = 0; j < rand() % 4; j++){ //up to 3 memberships per student
membership.push_back(MemberOf(students[i]));
}
}
cout<<"Assigning Professors..."<<endl;
for(int i = 0; i < facultyCount; i++){
for(int j = 0; j < rand() % 4; j++){ //faculty can teach up to 3 courses
instruction.push_back(Teaches(faculty[i]));
}
}
cout<<"Volunteering Faculty to Organizations..."<<endl;
for(int i = 0; i < organizationCount; i++){
if(rand() % 5 == 0) leadership.push_back(Leads()); //a quarter of organizations have faculty leadership
}
cout<<"Checking constraints..."<<endl;
for(int i = 0; i < courseCount; i++){
if(courses[i].size == 0){
cout<<"Empty course fixed\n";
enrollment.push_back(EnrolledIn(&courses[i]));
}
if(!courses[i].hasProf){
cout<<"Untaught course fixed\n";
instruction.push_back(Teaches(&courses[i]));
}
}
for(int i = 0; i < organizationCount; i++){
if(organizations[i].size == 0){
cout<<"Empty organization fixed\n";
membership.push_back(MemberOf(&organizations[i]));
}
}
cout<<"Writing data to file...\n"<<endl; //self explanatory vvvvvv
openFile();
for(int i = 0; i < facultyCount; i++){
writeFaculty(faculty[i].ID, faculty[i].name, faculty[i].salary);
}
for(int i = 0; i < studentCount; i++){
writeStudent(students[i].UIN, students[i].name, students[i].major, students[i].advisorID);
}
for(int i = 0; i < organizationCount; i++){
writeStudentOrganization(organizations[i].ID, organizations[i].name, organizations[i].category);
}
for(int i = 0; i < courseCount; i++){
writeCourse(courses[i].subject, courses[i].number, courses[i].hours, courses[i].title);
}
for(int i = 0; i < enrollment.size(); i++){
writeEnrolledIn(itosem(enrollment[i].semester), enrollment[i].subject, enrollment[i].number, enrollment[i].UIN, itograde(enrollment[i].grade));
}
for(int i = 0; i < instruction.size(); i++){
writeTeaches(instruction[i].subject, instruction[i].number, instruction[i].facultyID, itosem(instruction[i].semester));
}
for(int i = 0; i < leadership.size(); i++){
writeLeads(leadership[i].facultyID ,leadership[i].studentOrgID, itos(leadership[i].joinedMo)+"/"+itos(leadership[i].joinedYr));
}
for(int i = 0; i < membership.size(); i++){
writeMemberOf(membership[i].UIN, membership[i].studentOrgID, itos(membership[i].joinedMo)+"/"+itos(membership[i].joinedYr));
}
closeFile();
cout<<"All data generated"<<endl;
}
开发者ID:benbeadle,项目名称:database310project,代码行数:101,代码来源:generator.cpp
示例12: closeFile
//
// Desturctor
//
SystemFile::~SystemFile()
{
closeFile();
}
开发者ID:ejabx,项目名称:katana,代码行数:7,代码来源:systemfile.cpp
示例13: while
/**
@return true if all the files were closed. false if cancelled
*/
bool GData::closeAllFiles() {
while(!soundFiles.empty()) {
if(closeFile(soundFiles.at(0), gdata->savingMode()) == 1) return false; //cancelled
}
return true;
}
开发者ID:nsauzede,项目名称:tartini,代码行数:9,代码来源:gdata.cpp
示例14: connectRemote
retCode connectRemote(char *where, int port,
ioEncoding encoding, logical waitForMe,
ioPo *inC, ioPo *outC) {
int sock;
struct sockaddr_in serv_addr;
char *host = getHostname(where);
struct in_addr *addr = host != NULL ? getHostIP(host, 0) : NULL;
if (addr != NULL) {
/* Attempt to establish links to the server */
memset((char *) &serv_addr, 0, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr = *addr;
serv_addr.sin_port = htons((u_short) port);
/* Create the socket ... */
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) {
return Error;
} else {
ioPo conn = O_IO(newObject(sockClass, host, sock, encoding, ioREAD | ioWRITE));
configureIo(O_FILE(conn), (waitForMe ? turnOnBlocking : turnOffBlocking));
while (connect(sock, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) != 0) {
switch (errno) { // Unix version
case EACCES:
case EADDRNOTAVAIL:
outMsg(logFile, "Address %U not available", host);
markHostUnavail(host);
closeFile(O_IO(conn));
return Error;
case ECONNREFUSED:
outMsg(logFile, "Connection to %U refused", host);
markHostUnavail(host);
closeFile(O_IO(conn));
return Error;
case ETIMEDOUT:
outMsg(logFile, "Connection to %U timed out", host);
markHostUnavail(host);
closeFile(O_IO(conn));
return Error;
case ENETUNREACH:
outMsg(logFile, "Network down or %U unreachable", host);
markHostUnavail(host);
closeFile(O_IO(conn));
return Error;
case EALREADY:
case EINTR:
case EWOULDBLOCK:
case EINPROGRESS:
closeFile(O_IO(conn));
return Fail;
default:
outMsg(logFile, "Connection to %U refused", host);
markHostUnavail(host);
closeFile(O_IO(conn));
return Error;
}
}
*inC = conn;
*outC = conn;
return Ok;
}
} else {
outMsg(logFile, "cant resolve host %U", where);
return Error;
}
}
开发者ID:fmccabe,项目名称:l-and-o,代码行数:69,代码来源:sockets.c
示例15: closeFile
void FormattedFile::openFile(string filename)
{
closeFile();
mStream.open(filename);
}
开发者ID:astrellon,项目名称:SimpleRPG,代码行数:5,代码来源:FormattedFile.cpp
示例16: closeFile
FileV2::~FileV2()
{
if (m_poFp != NULL)
closeFile();
}
开发者ID:xkmld419,项目名称:crawl,代码行数:5,代码来源:FileV2.cpp
示例17: closeFile
Logger::~Logger()
{
closeFile();
SDL_DestroyMutex(mMutex);
}
开发者ID:mekolat,项目名称:ManaPlus,代码行数:5,代码来源:logger.cpp
示例18: closeFile
FileIO::~FileIO()
{
closeFile(true);
};
开发者ID:dustan1,项目名称:UsefulLibraries,代码行数:4,代码来源:FileIOMac.cpp
示例19: main
int main(int argc, char* argv[])
{
int i;
FILE* pFile;
size_t iLineSize;
bool bInitSuccess;
int iCurrLine;
struct sigaction sSigAct;
memset(&sSigAct,0,sizeof(struct sigaction));
sSigAct.sa_handler = inrptHandler;
if ( 0 != sigaction(SIGINT, &sSigAct,NULL))
{
DEBUG_PRINT("Signal Handler Registration Failed\n");
return 0;
}
bInitSuccess = false;
iCurrLine = 0,i = 0,pFile = NULL;
iLineSize = MAX_CONFIG_LINE;
memset(m_apArgs,0,sizeof(void*)*MAX_NUMBER_STREAMS);
memset(m_apStreamContext,0,sizeof(void*)*MAX_NUMBER_STREAMS);
pFile = openFile(CONFIG_FILE_NAME,"r");
if (pFile)
{
char* pcLine = malloc(iLineSize);
bInitSuccess = true;
while((iCurrLine<MAX_NUMBER_STREAMS) && (getline((char**)&pcLine,&iLineSize,pFile) != -1))
{
m_apArgs[iCurrLine] = (ThreadArgs*)malloc(sizeof(ThreadArgs));
memset(m_apArgs[iCurrLine],0,sizeof(ThreadArgs));
m_apStreamContext[iCurrLine] = (StreamContext*)malloc(sizeof(StreamContext));
memset(m_apStreamContext[iCurrLine],0,sizeof(StreamContext));
parseConfigLine(pcLine,m_apArgs[iCurrLine]);
/*assign cmd args to thread context*/
m_apStreamContext[iCurrLine]->psArgs = m_apArgs[iCurrLine];
printArg(m_apArgs[iCurrLine]);
/*get MPEG2TS data from file*/
if (!getStreamInfo(m_apArgs[iCurrLine]->acFileName,&(m_apStreamContext[iCurrLine]->iBitrate),
&(m_apStreamContext[iCurrLine]->dDuration),
&(m_apStreamContext[iCurrLine]->dAvgPeriod)))
{
DEBUG_PRINT("Failed to retriev MPEG2TS data for %s\n",m_apArgs[iCurrLine]->acFileName);
bInitSuccess = false;
break;
}
/*create queue names*/
memset(m_apStreamContext[iCurrLine]->acStreamQueueName,0,MAX_QUEUE_NAME);
sprintf(m_apStreamContext[iCurrLine]->acStreamQueueName,"/StreamingQueue%d",iCurrLine);
memset(m_apStreamContext[iCurrLine]->acEmptyQueueName,0,MAX_QUEUE_NAME);
sprintf(m_apStreamContext[iCurrLine]->acEmptyQueueName,"/EmptyQueue%d",iCurrLine);
if (createQueue(m_apStreamContext[iCurrLine]->acStreamQueueName,sizeof(AppMsg),MAX_DATA_MSG + 1,&(m_apStreamContext[iCurrLine]->iStreamQid)) < 0)
{
DEBUG_PRINT("Failed to create %s queue\n",m_apStreamContext[iCurrLine]->acStreamQueueName);
bInitSuccess = false;
break;
}
if (createQueue(m_apStreamContext[iCurrLine]->acEmptyQueueName,sizeof(AppMsg),MAX_DATA_MSG + 1,&(m_apStreamContext[iCurrLine]->iEmptyQid)) < 0)
{
DEBUG_PRINT("Failed to create %s queue\n",m_apStreamContext[iCurrLine]->acEmptyQueueName);
bInitSuccess = false;
break;
}
iCurrLine+=1;
memset(pcLine,0,iLineSize);
}
free(pcLine);
}
closeFile(pFile);
if (!m_apArgs[0])
{
DEBUG_PRINT("No configuration found\n");
return 0;
}
if (!bInitSuccess)
{
DEBUG_PRINT("The Application will exit\n");
cleanUp();
return 0;
}
while (m_apStreamContext[i]!=NULL)
{
populateFileReaderEmptyQueue(m_apStreamContext[i]->iEmptyQid);
startFileReader(m_apStreamContext[i]);
startStreamer(m_apStreamContext[i]);
i+=1;
}
i=0;
//.........这里部分代码省略.........
开发者ID:iourigordon,项目名称:soft_dev,代码行数:101,代码来源:funnel.c
示例20: closeFile
/**
* Destructor
*/
Traza::~Traza(){
closeFile();
}
开发者ID:damarbo33,项目名称:zipLaunch,代码行数:6,代码来源:traza.cpp
注:本文中的closeFile函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论