⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 file.cpp

📁 大名鼎鼎的传感器网络仿真实验室平台SENSE
💻 CPP
字号:
#include <cstdio>#include <sys/types.h>#include <sys/stat.h>#include <cerrno>#include <cstring>extern FILE	*yyin;extern FILE	*yyout;/********************************************* Function: ::openFile**** Opens the given file for reading and stores the file pointer in source.**** Return value:**	True if the file was opened, False otherwise.*/bool openFile(  const char	*fileName){  struct stat	statBuf;  if( stat( fileName, &statBuf) < 0)  {    fprintf( stderr, "fstat failed on file '%s': %s\n", fileName,	     strerror( errno));    return false;  }  if( (statBuf.st_mode & S_IFREG) == 0)  {    fprintf( stderr, "File '%s' is not a regular file\n", fileName);    return false;  }  yyin = fopen( fileName, "r");  if( yyin == 0)  {    fprintf( stderr, "Unable to open file '%s': %s\n", fileName,	     strerror( errno));    return false;  }  yyout = stderr;  return true;} /* end function ::openFile *//********************************************* Function: ::closeFile**** Closes the currently open status file.**** Return value:**	none*/void closeFile(){  fclose( yyin);  return;} /* end function ::closeFile */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -