您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ ACCESS函数代码示例

51自学网 2021-06-01 19:31:57
  C++
这篇教程C++ ACCESS函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中ACCESS函数的典型用法代码示例。如果您正苦于以下问题:C++ ACCESS函数的具体用法?C++ ACCESS怎么用?C++ ACCESS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了ACCESS函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: monitorSytemCalls

/** Begin System call monitoring ************************************************************/int monitorSytemCalls(FILE * logf, struct SCRIPT * script, struct TYPING * types, 					   unsigned long location, struct LINE * line){	char * tokens = (char *) calloc(TOKENMAXNB*TOKENSIZE,sizeof(char));	int nbtokens, i;		//Search for control operations	if(monitorFileControl(logf,script,types,location,line)) return 1;	if(monitorRegControl(logf,script,types,location,line)) return 1;	if(monitorMailControl(logf,script,types,location,line)) return 1;	//Search for input/output operations	if(monitorFileIO(logf,script,types,location,line)) return 1;	if(monitorRegIO(logf,script,types,location,line)) return 1;	if(monitorMailIO(logf,script,types,location,line)) return 1;	//Special folder (ignored in this version)	if(strcasestr(line->line,".GetSpecialFolder")) return 1;					//Parse line for script exit	nbtokens = decomposeLine(line->line,(char*)tokens,TOKENMAXNB,TOKENSIZE);	for(i=0;i<nbtokens;i++){		//Script generic object		if(isStaticScriptObject(ACCESS(tokens,i))>-1){			if(!strcasecmp(ACCESS(tokens,i+1),STOP0)){				line->type = SYSCALL;				printLogEntry(logf, types, OP_STOP, 0, 0);				return 1;			}//if		}	}//for	free(tokens);	return 0;}
开发者ID:khanjani,项目名称:malwarebehavioralautomata,代码行数:33,


示例2: xenmem_access_to_p2m_access

static bool xenmem_access_to_p2m_access(struct p2m_domain *p2m,                                        xenmem_access_t xaccess,                                        p2m_access_t *paccess){    static const p2m_access_t memaccess[] = {#define ACCESS(ac) [XENMEM_access_##ac] = p2m_access_##ac        ACCESS(n),        ACCESS(r),        ACCESS(w),        ACCESS(rw),        ACCESS(x),        ACCESS(rx),        ACCESS(wx),        ACCESS(rwx),        ACCESS(rx2rw),        ACCESS(n2rwx),#undef ACCESS    };    switch ( xaccess )    {    case 0 ... ARRAY_SIZE(memaccess) - 1:        *paccess = memaccess[xaccess];        break;    case XENMEM_access_default:        *paccess = p2m->default_access;        break;    default:        return false;    }    return true;}
开发者ID:mirage,项目名称:xen,代码行数:33,


示例3: SetState

// Initialize the application and telephony API. Blocks.State * TeleKarma::Initialize(Action * a, State * s){	if (s->id != STATE_UNINITIALIZED) return s;	bool flag = false;	InitializeAction * ia = dynamic_cast<InitializeAction *>(a);	State * result = NULL;	if (ia == NULL) {		result = SetState(new State(STATE_INITIALIZING, s->turn+1));		result = SetState(new State(result->id, result->turn, STATUS_FAILED, "Programming error: action cast failed"));		result = SetState(new State(STATE_UNINITIALIZED, result->turn+1));	} else {		// set stun server **before** entering INITIALIZING state		model->SetStunServer(ia->stunServer);		result = SetState(new State(STATE_INITIALIZING, s->turn+1));		// verify existence and type of 'logs' folder		const char * strPath1 = "logs";		struct stat status;		stat(strPath1, &status);		bool existsLogs = !((ACCESS(strPath1, 0) == -1) || !(status.st_mode & S_IFDIR));		// verify existence and type of 'recordings' folder		const char * strPath2 = "recordings";		stat(strPath2, &status);		bool existsRecordings = !((ACCESS(strPath2, 0) == -1) || !(status.st_mode & S_IFDIR));		if (!(existsLogs || existsRecordings)){			result = SetState(new State(result->id, result->turn, STATUS_FAILED, "Please create /"logs/" and /"recordings/" folders in your TeleKarma program folder."));			flag = true;		} else if (!existsLogs) {			result = SetState(new State(result->id, result->turn, STATUS_FAILED, "Please create a /"logs/" folder in your TeleKarma program folder."));			flag = true;		} else if (!existsRecordings) {			result = SetState(new State(result->id, result->turn, STATUS_FAILED, "Please create a /"recordings/" folder in your TeleKarma program folder."));			flag = true;		}		if (flag) {			result = SetState(new State(STATE_UNINITIALIZED, result->turn+1));		} else {			// create log file			PTime now;			PString logFName("logs/log");			logFName += now.AsString("_yyyy.MM.dd_hh.mm.ss");			logFName += ".txt";			PTrace::Initialise(3, logFName);			// initialize telephony (blocking call)			phone->Initialise(ia->stunServer);			PSTUNClient * stunClient = phone->GetSTUNClient();			if (stunClient != NULL) {				model->SetStunType(stunClient->GetNatTypeName());			} else {				model->SetStunType("none");			}			result = SetState(new State(STATE_INITIALIZED, result->turn+1));		}	}	return result;}
开发者ID:TeleKarma,项目名称:TeleKarma,代码行数:56,


示例4: write_pid_file

/** * Write PID file. * * @param sctx service context * @param pid PID to write (should be equal to 'getpid()' * @return  #GNUNET_OK on success (including no work to be done) */static intwrite_pid_file (struct GNUNET_SERVICE_Context *sctx, pid_t pid){  FILE *pidfd;  char *pif;  char *user;  char *rdir;  int len;  if (NULL == (pif = get_pid_file_name (sctx)))    return GNUNET_OK;           /* no file desired */  user = get_user_name (sctx);  rdir = GNUNET_strdup (pif);  len = strlen (rdir);  while ((len > 0) && (rdir[len] != DIR_SEPARATOR))    len--;  rdir[len] = '/0';  if (0 != ACCESS (rdir, F_OK))  {    /* we get to create a directory -- and claim it     * as ours! */    (void) GNUNET_DISK_directory_create (rdir);    if ((NULL != user) && (0 < strlen (user)))      GNUNET_DISK_file_change_owner (rdir, user);  }  if (0 != ACCESS (rdir, W_OK | X_OK))  {    LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "access", rdir);    GNUNET_free (rdir);    GNUNET_free_non_null (user);    GNUNET_free (pif);    return GNUNET_SYSERR;  }  GNUNET_free (rdir);  pidfd = FOPEN (pif, "w");  if (NULL == pidfd)  {    LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "fopen", pif);    GNUNET_free (pif);    GNUNET_free_non_null (user);    return GNUNET_SYSERR;  }  if (0 > FPRINTF (pidfd, "%u", pid))    LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fprintf", pif);  GNUNET_break (0 == FCLOSE (pidfd));  if ((NULL != user) && (0 < strlen (user)))    GNUNET_DISK_file_change_owner (pif, user);  GNUNET_free_non_null (user);  GNUNET_free (pif);  return GNUNET_OK;}
开发者ID:tg-x,项目名称:gnunet,代码行数:58,


示例5: access_game

access_game (char *filename, char *mode, size_t (*af) ()){FILE *fd;	fd = fopen (filename, mode);	if (fd != NULL)	{		ACCESS (map)		ACCESS (men)		ACCESS (man)		ACCESS (mutant)		ACCESS (level)		fclose (fd);	}}
开发者ID:jbailhache,项目名称:log,代码行数:14,


示例6: playWav

void playWav(char* filename, float samplerate){    int fp= STDIN_FILENO;    if(filename[0]!='-') fp = open(filename, 'r');    //int sz = lseek(fp, 0L, SEEK_END);    //lseek(fp, 0L, SEEK_SET);    //short* data = (short*)malloc(sz);    //read(fp, data, sz);        int bufPtr=0;    float datanew, dataold = 0;    short data;        for (int i=0; i<22; i++)       read(fp, &data, 2);  // read past header        while (read(fp, &data, 2)) {        float fmconstant = samplerate * 50.0e-6;  // for pre-emphisis filter.  50us time constant        int clocksPerSample = 22500.0/samplerate*1400.0;  // for timing        datanew = (float)(data)/32767;                float sample = datanew + (dataold-datanew) / (1-fmconstant);  // fir of 1 + s tau        float dval = sample*15.0;  // actual transmitted sample.  15 is bandwidth (about 75 kHz)                int intval = (int)(round(dval));  // integer component        float frac = (dval - (float)intval)/2 + 0.5;        unsigned int fracval = frac*clocksPerSample;                 bufPtr++;        while( ACCESS(DMABASE + 0x04 /* CurBlock*/) ==  (int)(instrs[bufPtr].p)) usleep(1000);        ((struct CB*)(instrs[bufPtr].v))->SOURCE_AD = (int)constPage.p + 2048 + intval*4 - 4 ;                bufPtr++;        while( ACCESS(DMABASE + 0x04 /* CurBlock*/) ==  (int)(instrs[bufPtr].p)) usleep(1000);        ((struct CB*)(instrs[bufPtr].v))->TXFR_LEN = clocksPerSample-fracval;                bufPtr++;        while( ACCESS(DMABASE + 0x04 /* CurBlock*/) ==  (int)(instrs[bufPtr].p)) usleep(1000);        ((struct CB*)(instrs[bufPtr].v))->SOURCE_AD = (int)constPage.p + 2048 + intval*4+4;                bufPtr=(bufPtr+1) % (1024);        while( ACCESS(DMABASE + 0x04 /* CurBlock*/) ==  (int)(instrs[bufPtr].p)) usleep(1000);        ((struct CB*)(instrs[bufPtr].v))->TXFR_LEN = fracval;                dataold = datanew;    }    close(fp);}
开发者ID:valenting,项目名称:SoundBerryer,代码行数:49,


示例7: Cmiss_differential_operator

	Cmiss_differential_operator(FE_region *fe_region, int dimension, int term) :		fe_region(ACCESS(FE_region)(fe_region)),		dimension(dimension),		term(term),		access_count(1)	{	}
开发者ID:A1kmm,项目名称:libzinc,代码行数:7,


示例8: CWE367_TOC_TOU__access_01_bad

void CWE367_TOC_TOU__access_01_bad(){    {        char filename[100] = "";        int fileDesc = -1;        if (fgets(filename, 100, stdin) == NULL)        {            printLine("fgets() failed");            /* Restore NUL terminator if fgets fails */            filename[0] = '/0';        }        if (strlen(filename) > 0)        {            filename[strlen(filename)-1] = '/0'; /* remove newline */        }        /* FLAW: Open and write to the file after checking the status information */        if (ACCESS(filename, W_OK) == -1)        {            exit(1);        }        fileDesc  = OPEN(filename, O_RDWR);        if (fileDesc == -1)        {            exit(1);        }        if (WRITE(fileDesc, BAD_SINK_STRING, strlen(BAD_SINK_STRING)) == -1)        {            exit(1);        }        if (fileDesc != -1)        {            CLOSE(fileDesc);        }    }}
开发者ID:gpwi970725,项目名称:testJuliet2,代码行数:35,


示例9: getScreenDC

UINT AviConverter::run() {  try {    CPicture picture;    picture.load(m_nameArray[0]);    const CSize imageSize = picture.getSize();    HDC screenDC = getScreenDC();    m_dc     = CreateCompatibleDC(screenDC);    m_bitmap = CreateCompatibleBitmap(screenDC, imageSize.cx, imageSize.cy);    DeleteDC(screenDC);    DWORD codec = 0; // mmioFOURCC('w','m','v',' ');    if(ACCESS(m_outFileName, 0) == 0) {      UNLINK(m_outFileName);    }    CAviFile aviFile(m_outFileName, true, codec, m_framesPerSecond);    for(m_index = 0; m_index < (int)m_nameArray.size(); m_index += m_useEvery) {      if(isInterrupted()) {        throwException(_T("Interrupted by user"));      }      picture.load(m_nameArray[m_index]);      HGDIOBJ oldGDI = SelectObject(m_dc, m_bitmap);      picture.show(m_dc);      SelectObject(m_dc, oldGDI);      aviFile.appendNewFrame(m_bitmap);    }  } catch(Exception e) {    m_ok  = false;    m_msg = e.what();  }  return 0;}
开发者ID:JesperMikkelsen,项目名称:Big-Numbers,代码行数:33,


示例10: ensure_dir

int ensure_dir(const char *sPathName){	char DirName[MAX_PATH];	int i, len = 0;	strcpy(DirName, sPathName);	len = (int)strlen(DirName);	if (DirName[len - 1] != '/')		strcat(DirName, "/");	len = (int)strlen(DirName);	for (i = 1; i < len; i++) {		if (DirName[i] == '/' || DirName[i] == '//') {			DirName[i] = 0;//			printf("%s/n", DirName);			if (ACCESS(DirName, 0) != 0) {				if (MKDIR(DirName) != 0) {					printf("mkdir %s error %d/n", DirName, GETLASTERROR);					return -1;				}			}			DirName[i] = '/';		}	}	return 0;}
开发者ID:zhifeichen,项目名称:libcapture,代码行数:27,


示例11: Lia_Fifo_Read

/*********************************************Functon:    Lia_Fifo_ReadDescription:  read context from fifoAuthor: liujianDate: 2015/09/04Input: void * pBuf:the context being readed from fifo		pi8Path:fifo path		i32MaxReadLen:maxium length of readReturns: 0 indicates success		negative numbers indicate failure*********************************************/Int32 Lia_Fifo_Read(Int8 *pi8Path,void * pBuf,Int32 i32MaxReadLen){	Int32 i32Fd=-1;	Int32 i32ReadCnt = -1;	JUDGE_POINTER_IS_NULL(pBuf);	JUDGE_POINTER_IS_NULL(pi8Path);	ACCESS(pi8Path,F_OK);	i32Fd=open(pi8Path, O_RDONLY,0);	if (i32Fd < 0)	{		printf("open error:%s/n", strerror(errno));		return -1;	}	i32ReadCnt = read(i32Fd, pBuf, i32MaxReadLen);	if (i32ReadCnt<0)	{		printf("read error/n");		return -1;	}	else if(0== i32ReadCnt)//write fifo has closed,unlink the read fifo	{		unlink(pi8Path);	}	close(i32Fd);	return 0;}
开发者ID:liuchanchen,项目名称:Test,代码行数:38,


示例12: defined

bool QFile::exists( const char *fileName ){#if defined(CHECK_NULL)    ASSERT( fileName != 0 );#endif    return ACCESS( fileName, F_OK ) == 0;}
开发者ID:kthxbyte,项目名称:Qt1.45-Linaro,代码行数:7,


示例13: setup_fm

void setup_fm(){    /* open /dev/mem */    if ((mem_fd = open("/dev/mem", O_RDWR|O_SYNC) ) < 0) {        printf("can't open /dev/mem /n");        exit (-1);    }        allof7e = (unsigned *)mmap(                  NULL,                  0x01000000,  //len                  PROT_READ|PROT_WRITE,                  MAP_SHARED,                  mem_fd,                  0x20000000  //base              );    if ((int)allof7e==-1) exit(-1);    SETBIT(GPFSEL0 , 14);    CLRBIT(GPFSEL0 , 13);    CLRBIT(GPFSEL0 , 12);     struct GPCTL setupword = {6/*SRC*/, 1, 0, 0, 0, 1,0x5a};    ACCESS(CM_GP0CTL) = *((int*)&setupword);}
开发者ID:valenting,项目名称:SoundBerryer,代码行数:29,


示例14: jackpifm_setup_fm

int jackpifm_setup_fm() {  /* open /dev/mem */  if ((mem_fd = open("/dev/mem", O_RDWR|O_SYNC) ) < 0) {    fprintf(stderr, "Can't open /dev/mem: %s/n", strerror(errno));    return 1;  }  allof7e = (unsigned *)mmap(      NULL,      0x01000000,  //len      PROT_READ|PROT_WRITE,      MAP_SHARED,      mem_fd,      0x20000000  //base  );  if ((int)allof7e==-1) return 1;  SETBIT(GPFSEL0 , 14);  CLRBIT(GPFSEL0 , 13);  CLRBIT(GPFSEL0 , 12);  struct GPCTL setupword = {6/*SRC*/, 1, 0, 0, 0, 1,0x5a};  ACCESS(CM_GP0CTL) = *((int*)(&setupword));  return 0;}
开发者ID:jmendeth,项目名称:jackpifm,代码行数:26,


示例15: defined

// create the file, fail if it already exists and bOverwritebool wxFile::Create(const wxChar *szFileName, bool bOverwrite, int accessMode){    // if bOverwrite we create a new file or truncate the existing one,    // otherwise we only create the new file and fail if it already exists#if defined(__WXMAC__) && !defined(__UNIX__) && !wxUSE_UNICODE    // Dominic Mazzoni [[email
C++ ACCESS_CHECK函数代码示例
C++ ACADOERROR函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。