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

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

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

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

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

示例1: TimeIt

VOID TimeIt(){    TIMESTAMP   tsStart, tsStop;    ULONG       ulRC, ulMsecs, ulNsecs, ulBytes;    printf( "/nHit Ctrl-C to terminate this test program.../n" );    for( ; ; )    {        printf( "/nSleeping for %u milliseconds...", ulTimePeriod );        fflush( stdout );        ulRC = DosRead( hfTimer, &tsStart, sizeof( TIMESTAMP ), &ulBytes );        if( ulRC )        {            printf( "/nDosRead for start got a retcode of %u", ulRC );            return;        }        DosSleep( ulTimePeriod );        ulRC = DosRead( hfTimer, &tsStop, sizeof( TIMESTAMP ), &ulBytes );        if( ulRC )        {            printf( "/nDosRead for stop got a retcode of %u", ulRC );            return;        }        ulMsecs = CalcElapsedTime( &tsStart, &tsStop,                                   ulOverheadMs, ulOverheadNs, &ulNsecs );        printf( " elapsed time (ms:ns) = %06u:%06u", ulMsecs, ulNsecs );    }}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:28,


示例2: ReadData

BOOL ReadData( HFILE handle )   {   BOOL   ret = FALSE;   char * p1;   int    dif;   char   crc[2];   ULONG  bytesread;   ULONG  actual;   DosRead( handle, tmpbuf, BUFSIZE, &bytesread );   if ( bytesread )      {      if (p1=memchr( tmpbuf, EOFFLAG, bytesread ) )         {         dif        = bytesread - (int)(p1-tmpbuf);         bytesread -= dif;         if (dif < 3)            {            DosRead( handle, crc+dif, 3-dif, &bytesread );            if (dif==1)               crc[0] = *(p1+1);            rc = *(unsigned int *)crc;            }         else            rc = *(unsigned int *)(p1+1);         ret = TRUE;         } /* endif */      DosWrite( 1, tmpbuf, bytesread, &actual );      }   return( ret );   }
开发者ID:OS2World,项目名称:DEV-SAMPLES-WorkFrame2,代码行数:35,


示例3: SERIAL_getextchar

int SERIAL_getextchar(COMPORT port) {	ULONG dwRead = 0;	// Number of chars read	char chRead;	int retval = 0;	// receive a byte; TODO communicate failure	if (DosRead(port->porthandle, &chRead, 1, &dwRead) == NO_ERROR) {		if (dwRead) {			// check for errors; will OS/2 clear the error on reading its data?			// if yes then this is in wrong order			USHORT errors = 0, event = 0;			ULONG ulParmLen = sizeof(errors);			DosDevIOCtl(port->porthandle, IOCTL_ASYNC, ASYNC_GETCOMMEVENT,				0, 0, 0, &event, ulParmLen, &ulParmLen);			if (event & (64 + 128) ) { // Break (Bit 6) or Frame or Parity (Bit 7) error				Bit8u errreg = 0;				if (event & 64) retval |= SERIAL_BREAK_ERR;				if (event & 128) {					DosDevIOCtl(port->porthandle, IOCTL_ASYNC, ASYNC_GETCOMMERROR,						0, 0, 0, &errors, ulParmLen, &ulParmLen);					if (errors & 8) retval |= SERIAL_FRAMING_ERR;					if (errors & 4) retval |= SERIAL_PARITY_ERR;				}			}			retval |= (chRead & 0xff);			retval |= 0x10000; 		}	}	return retval;}
开发者ID:GREYFOXRGR,项目名称:em-dosbox,代码行数:30,


示例4: Thread

VOID APIENTRY Thread(VOID){   APIRET rc;   ULONG ulNumBytes;   TRACE_EVENT te;   printf("Thread() started/n");   rc = DosSetPriority(PRTYS_THREAD, PRTYC_TIMECRITICAL, 0, 0);   if (rc) {      printf("Thread() DosSetPriority failed with RC = %lu/n", rc);      return;   }   fRunning = TRUE;   while (!fQuit) {      rc = DosRead(hfile, &te, sizeof(TRACE_EVENT), &ulNumBytes);      if (rc) {         printf("Error %d while calling device driver/n", rc);         return;      }      ShowTrace(te);   }   printf("Thread() stopped/n");   fRunning = FALSE;}
开发者ID:OS2World,项目名称:DRV-MPU-401,代码行数:26,


示例5: fread

/****************************************************************************REMARKS:VDD implementation of the ANSI C fread function. Note that unlike Windows VxDs,OS/2 VDDs are not limited to 64K reads or writes.****************************************************************************/size_t fread(    void *ptr,    size_t size,    size_t n,    FILE *f){    char    *buf = ptr;    int     bytes,readbytes,totalbytes = 0;    /* First copy any data already read into our buffer */    if ((bytes = (f->curp - f->startp)) > 0) {	memcpy(buf,f->curp,bytes);	f->startp = f->curp = f->buf;	buf += bytes;	totalbytes += bytes;	bytes = (size * n) - bytes;	}    else	bytes = size * n;    if (bytes) {	#ifdef __OS2_VDD__	readbytes = VDHRead((HFILE)f->handle, buf, bytes);	#else	DosRead((HFILE)f->handle, buf, bytes, &readbytes);	#endif	totalbytes += readbytes;	f->offset += readbytes;	}    return totalbytes / size;}
开发者ID:A1DEVS,项目名称:lenovo_a1_07_uboot,代码行数:35,


示例6: ServiceRequests

static VOID APIENTRY ServiceRequests( VOID ){    USHORT              len;    pmhelp_packet       data;    WinCreateMsgQueue( Hab, 0 );    for( ;; ) {        if( DosRead( InStream, &data, sizeof( data ), &len ) != 0 ) break;        if( len != sizeof( data ) ) break;        switch( data.command ) {        case PMHELP_LOCK:            PidDebugee = data.pid;            TidDebugee = data.tid;            LockIt();            break;        case PMHELP_UNLOCK:            PidDebugee = data.pid;            TidDebugee = data.tid;            UnLockIt();            break;        case PMHELP_EXIT:            WinPostMsg( hwndClient, WM_QUIT, 0, 0 );/* Cause termination*/            break;        }        WinInvalidateRegion( hwndClient, 0L, FALSE );    }    Say( "Read Failed" );}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:28,


示例7: Reader

void _System Reader(ULONG arg){    int        data;    ULONG      read;    int        new_index;    APIRET     rc;    OverRun = FALSE;    for( ;; ) {        rc = DosRead( ComPort, &data, 1, &read );        if( rc != NO_ERROR )            break;        if( read == 1 ) {            new_index = ReadBuffAdd + 1;            new_index &= BSIZE-1;            if( new_index == ReadBuffRemove ) {                OverRun = TRUE;            } else {                ReadBuff[ ReadBuffAdd ] = data;                ReadBuffAdd = new_index;            }            DosPostEventSem( ReadSemaphore );        }    }}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:25,


示例8: while

char far *InitAlias( char far * inname )/**************************************/{    USHORT hdl,read;    static char b[80];    char *bp;    unsigned long ppos,pos;    USHORT action;    char far *endname;    static char noalias = 0;    endname = inname;    while( *endname == ' ' ) ++endname;    for( ;; ) {        if( *endname == '/0' ) {            break;        }        if( *endname == ' ' ) {            *endname = '/0';            ++endname;            break;        }        ++endname;    }    bp = b;    while( *bp = *inname ) {        ++bp;        ++inname;    }    action=action;    if( DosOpen( b, &hdl, &action, 0L, 0, 1, 0x10 ,0L ) == 0 ) {        DosChgFilePtr( hdl, 0L, 2, &ppos );        pos = ppos;        DosChgFilePtr( hdl, 0L, 0, &ppos );#ifdef DOS        {            static int alias_seg;            DosAllocSeg( pos + 1 + ALIAS_SLACK, &alias_seg, 0 );            *(((int far *)&AliasList)+0) = 0;            *(((int far *)&AliasList)+1) = alias_seg;            AliasSize = pos + ALIAS_SLACK;        }#else        AliasList = AliasArea;        AliasSize = 2047;#endif        DosRead( hdl, AliasList, pos, &read );        if( pos > 0 && AliasList[ pos-1 ] != '/n' ) {            AliasList[ pos+0 ] = '/r';            AliasList[ pos+1 ] = '/n';            AliasList[ pos+2 ] = '/0';        } else {            AliasList[ pos ] = '/0';        }        DosClose( hdl );    } else {        AliasList = &noalias;    }    return( endname );}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:60,


示例9: os2Read

/*** Read data from a file into a buffer.  Return SQLITE_OK if all** bytes were read successfully and SQLITE_IOERR if anything goes** wrong.*/static int os2Read(  sqlite3_file *id,               /* File to read from */  void *pBuf,                     /* Write content into this buffer */  int amt,                        /* Number of bytes to read */  sqlite3_int64 offset            /* Begin reading at this offset */){  ULONG fileLocation = 0L;  ULONG got;  os2File *pFile = (os2File*)id;  assert( id!=0 );  SimulateIOError( return SQLITE_IOERR_READ );  OSTRACE3( "READ %d lock=%d/n", pFile->h, pFile->locktype );  if( DosSetFilePtr(pFile->h, offset, FILE_BEGIN, &fileLocation) != NO_ERROR ){    return SQLITE_IOERR;  }  if( DosRead( pFile->h, pBuf, amt, &got ) != NO_ERROR ){    return SQLITE_IOERR_READ;  }  if( got == (ULONG)amt )    return SQLITE_OK;  else {    /* Unread portions of the input buffer must be zero-filled */    memset(&((char*)pBuf)[got], 0, amt-got);    return SQLITE_IOERR_SHORT_READ;  }}
开发者ID:erik-knudsen,项目名称:eCos-enhancements,代码行数:31,


示例10: read_func

size_t read_func(void *ptr, size_t size, size_t nmemb, void *datasource){    ULONG ulActual;    DosRead( (HFILE)datasource, ptr, (size*nmemb), &ulActual );    return ulActual / size;}
开发者ID:OS2World,项目名称:MM-SOUND-PM123-OggPlug,代码行数:7,


示例11: TRANS

static intTRANS(Os2Read)(XtransConnInfo ciptr, char *buf, int size){    int ret;    APIRET rc;    ULONG ulRead;    PRMSG(2,"Os2Read(%d,%x,%d)/n", ciptr->fd, buf, size );    errno = 0;    rc = DosRead(ciptr->fd, buf, size, &ulRead);    if (rc == 0){        ret = ulRead;        }    else if ((rc == 232) || (rc == 231)){        errno = EAGAIN;        ret = -1;        }    else if (rc == 6){        errno = EBADF;        ret = -1;        }     else if ((rc == 109) || (rc == 230) || (rc == 233)){        errno = EPIPE;       ret = -1;        }    else {           PRMSG(2,"Os2Read: Unknown return code from DosRead, fd %d rc=%d/n", ciptr->fd,rc,0 );           errno = EINVAL;           ret = -1;           }    return (ret);}
开发者ID:HoMeCracKeR,项目名称:MacOSX-SDKs,代码行数:31,


示例12: GetDos32Debug

/* * get the address of Dos32Debug, and get the flat selectors, too. */int GetDos32Debug( char __far *err ){    char        buff[256];    RESULTCODES resc;    USHORT      dummy;    PSZ         start;    PSZ         p;    HFILE       inh;    HFILE       outh;    USHORT      rc;    struct {        ULONG       dos_debug;        USHORT      cs;        USHORT      ds;        USHORT      ss;    }           data;    rc = DosGetModName( ThisDLLModHandle, sizeof( buff ), buff );    if( rc ) {        StrCopy( TRP_OS2_no_dll, err );        return( FALSE );    }    start = buff;    for( p = buff; *p != '/0'; ++p ) {        switch( *p ) {        case ':':        case '//':        case '/':           start = p + 1;           break;        }    }    p = StrCopy( LOCATOR, start );    if( DosMakePipe( &inh, &outh, sizeof( data ) ) ) {        StrCopy( TRP_OS2_no_pipe, err );        return( FALSE );    }    *++p = outh + '0';    *++p = '/0';    *++p = '/0';    rc = DosExecPgm( NULL, 0, EXEC_ASYNC, buff, NULL, &resc, buff );    DosClose( outh );    if( rc )  {        DosClose( inh );        StrCopy( TRP_OS2_no_help, err );        return( FALSE );    }    rc = DosRead( inh, &data, sizeof( data ), &dummy );    DosClose( inh );    if( rc ) {        StrCopy( TRP_OS2_no_help, err );        return( FALSE );    }    DebugFunc = (void __far *)data.dos_debug;    FlatCS = (USHORT) data.cs;    FlatDS = (USHORT) data.ds;    _retaddr = MakeLocalPtrFlat( (void __far *)DoReturn );    return( TRUE );}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:63,


示例13: init

static void init( void ){    ULONG     rc;    ULONG     action;    ULONG     bytes;    rc = DosOpen( "WTIMER$", &timerHandle, &action, 0,                   FILE_NORMAL, FILE_OPEN, OPEN_SHARE_DENYNONE, NULL );    if( rc == 0 ) {        DosRead( timerHandle, &startTime, sizeof( TIMESTAMP ), &bytes );        DosRead( timerHandle, &stopTime, sizeof( TIMESTAMP ), &bytes );        calc_time( &overHead, &startTime, &stopTime, NULL );        DosRead( timerHandle, &startTime, sizeof( TIMESTAMP ), &bytes );    } else {        printf( "Could not open WTIMER$/n" );    }}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:17,


示例14: while

char __far *InitAlias( char __far * inname )/******************************************/{    USHORT          hdl,read;    static char     b[80];    char            *bp;    unsigned long   ppos,pos;    USHORT          action;    char            __far *endname;    static char     noalias = 0;#ifndef DOS    static char     AliasArea[2048]; /* The DLL seems to need static memory */#endif    endname = inname;    while( *endname == ' ' )        ++endname;    for( ; *endname != '/0'; endname++ ) {        if( *endname == ' ' ) {            *endname++ = '/0';            break;        }    }    for( bp = b; (*bp = *inname) != '/0'; bp++ ) {        ++inname;    }    action=action;    if( DosOpen( b, &hdl, &action, 0L, 0, 1, 0x10 ,0L ) == 0 ) {        DosChgFilePtr( hdl, 0L, 2, &ppos );        pos = ppos;        DosChgFilePtr( hdl, 0L, 0, &ppos );#ifdef DOS        {            static int alias_seg;            DosAllocSeg( pos + 1 + ALIAS_SLACK, &alias_seg, 0 );            AliasList = (char __far *)MK_FP( alias_seg, 0 );            AliasSize = pos + ALIAS_SLACK;        }#else        AliasList = AliasArea;        AliasSize = 2047;#endif        DosRead( hdl, AliasList, pos, &read );        if( pos > 0 && AliasList[pos - 1] != '/n' ) {            AliasList[pos + 0] = '/r';            AliasList[pos + 1] = '/n';            AliasList[pos + 2] = '/0';        } else {            AliasList[pos] = '/0';        }        DosClose( hdl );    } else {        AliasList = &noalias;    }    return( endname );}
开发者ID:ArmstrongJ,项目名称:open-watcom-v2,代码行数:57,


示例15: CheckSystemConfig

VOID CheckSystemConfig( VOID ){ // Проверяем настройки в файле "Config.sys". CHAR File_name[ SIZE_OF_NAME ] = "*://Config.sys"; ULONG Boot_drive = 0; DosQuerySysInfo( QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, (PULONG) &Boot_drive, sizeof( Boot_drive ) ); File_name[ 0 ] = (CHAR) Boot_drive + 64; ULONG Action = OPEN_ACTION_OPEN_IF_EXISTS; ULONG Mode = OPEN_FLAGS_FAIL_ON_ERROR | OPEN_SHARE_DENYWRITE | OPEN_ACCESS_READONLY; HFILE File = NULLHANDLE; ULONG Report = 0; APIRET RC = DosOpen( File_name, &File, &Report, 0, FILE_NORMAL, Action, Mode, NULL ); // Если файл был открыт: if( RC == NO_ERROR )  {   // Отводим память для текста.   PCHAR Text = NULL; ULONG Length = 65536;   if( DosAllocMem( (PPVOID) &Text, Length, PAG_ALLOCATE ) != NO_ERROR )    {     DosClose( File );     DosExit( EXIT_PROCESS, 0 );    }   // Читаем настройки.   memset( Text, 0, Length );   DosRead( File, Text, Length, &Length );   // Проверяем, есть ли в настройках путь к каталогу расширителя.   BYTE Path_is_present = 1; if( !stristr( "NICE//ENHANCER", Text ) ) Path_is_present = 0;   // Освобождаем память.   DosFreeMem( Text ); Text = NULL;   // Закрываем файл.   DosClose( File ); File = NULLHANDLE;   // Если настройки заданы неправильно:   if( !Path_is_present )    {     // Показываем сообщение.     CHAR Title[ SIZE_OF_TITLE ] = ""; GetEnhancerWindowTitle( Title );     if( QuerySystemCodePage() == RUSSIAN )      WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, StrConst_RU_No_path_in_Config_sys, Title, NULLHANDLE, NULLHANDLE );     else      WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, StrConst_EN_No_path_in_Config_sys, Title, NULLHANDLE, NULLHANDLE );     // Выход.     DosExit( EXIT_PROCESS, 0 );    }  } // Возврат. return;}
开发者ID:OS2World,项目名称:UTIL-WPS-Nice_OS2_Enhancer,代码行数:56,


示例16: DosRead

char *ReadPipe(int iPipe){    APIRET rc;    ULONG ulTotal     = 0;    ULONG ulBytesRead = 0;    Chunk* pHead = new Chunk;    Chunk* pCurr = pHead;    do    {        ulBytesRead = 0;        rc = DosRead(0, pCurr->data, sizeof(pCurr->data), &ulBytesRead);        pCurr->sz = ulBytesRead;        ulTotal += ulBytesRead;        if(ulBytesRead)        {            pCurr->next = new Chunk;            pCurr       = pCurr->next;        }    }    while(!rc && ulBytesRead);    char *str = 0;    if(ulTotal)    {        str = new char[ulTotal+1];        char *ptr = str;        for(pCurr = pHead; pCurr; pCurr = pCurr->next)        {            if(!pCurr->sz)                continue;            memcpy(ptr, pCurr->data, pCurr->sz);            ptr += pCurr->sz;        }        *ptr = 0;    }    //Free memory    for(pCurr = pHead; pCurr; )    {        Chunk* pTmp  = pCurr;        pCurr = pCurr->next;        delete pTmp;    }    return str;}
开发者ID:OS2World,项目名称:UTIL-CLIPBOARD-Clip,代码行数:56,


示例17: bytes

/* -------------------------------------------------------------------------- Read 'cb' bytes from the file 'hf' into the buffer 'pBuffer'. Display an error message in case of error.- Parameters ------------------------------------------------------------- HFILE hf      : file handle. PVOID pBuffer : read buffer. ULONG cb      : count of bytes to be read.- Return value ----------------------------------------------------------- LONG : count of succesfully read bytes (-1 in case of error).-------------------------------------------------------------------------- */LONG fmRead(HFILE hf, PVOID pBuffer, ULONG cb) {   ULONG cbRead;   g.rc = DosRead(hf, pBuffer, cb, &cbRead);   if (g.mode & FSJVERBOSE)      printMsg(IROW_DEBUG, SZ_FREAD, hf, cb, cbRead, g.rc);   if (g.rc)      return handleFileIOError(-1, SZERR_READFILE, "", g.rc);   return cbRead;}
开发者ID:OS2World,项目名称:UTIL-FILE-FSJ,代码行数:21,


示例18: csysOpen

COUNT csysOpen(void){	COUNT fd;	struct nlsCSys_fileHeader header;	if((fd = DosOpen((BYTE FAR*)filename, 0)) < 0) {		printf("Cannot open: /"%s/"/n", filename);		return 1;	}	if(DosRead(fd, &header, sizeof(header)) != sizeof(header);	 || strcmp(header.csys_idstring, CSYS_FD_IDSTRING) != 0
开发者ID:TijmenW,项目名称:FreeDOS,代码行数:11,


示例19: GBMReadPalette

// read bitmap color paletteBOOL GBMReadPalette( HFILE hFile, GBM *gbm, GBMRGB *gbmrgb ){    BMP_PRIV *bmp_priv = ( BMP_PRIV * )gbm->priv;    ULONG ulActual;    if( gbm->bpp != 24 )    {        int i;        BYTE b[4];        if( bmp_priv->windows )             // OS/2 2.0 and Windows 3.0        {            DosSetFilePtr(  hFile,                                  // set to beginning of palette                            bmp_priv->base + 14L + bmp_priv->cbFix,                            FILE_BEGIN,                            &ulActual );            for( i = 0; i < ( int )bmp_priv->cclrUsed; i++ )        // read colors            {                DosRead( hFile, b, 4, &ulActual );                  // colors are in file as bgr                ( gbmrgb + i )->Blue    = *b;                ( gbmrgb + i )->Green   = *( b + 1 );                ( gbmrgb + i )->Red     = *( b + 2 );            }        }        else                                                        // OS/2 1.1 and 1.2        {            DosSetFilePtr( hFile, bmp_priv->base + 26L, FILE_BEGIN, &ulActual );  // set to palette start            for( i = 0; i < ( 1 << gbm->bpp ); i++ )                            // read colors            {                DosRead( hFile, b, 3, &ulActual );                  // colors are in file as bgr                ( gbmrgb + i )->Blue    = *b;                ( gbmrgb + i )->Green   = *( b + 1 );                ( gbmrgb + i )->Red     = *( b + 2 );            }        }    }    return( TRUE );}
开发者ID:OS2World,项目名称:UTIL-WPS-CandyBarz,代码行数:42,


示例20: ReadConfigFile

int ReadConfigFile(HWND hwnd, char szFileSpec[],char **ppBuffer)  {  ULONG ulStatus;  HFILE hFile;  FILESTATUS3 stFileInfo;  int iCount;  char szMessage[CCHMAXPATH];  APIRET rc;  if ((rc = DosOpen(szFileSpec,&hFile,&ulStatus,0L,0,1,0x0022,(PEAOP2)0L)) != 0)    {    if (hwnd != NULLHANDLE)      {      sprintf(szMessage,"Could not open %s - Error = %u",szFileSpec,rc);      MessageBox(HWND_DESKTOP,szMessage);      }    return(0);    }  DosQueryFileInfo(hFile,1,&stFileInfo,sizeof(FILESTATUS3));  iCount = stFileInfo.cbFile;  if ((rc = DosAllocMem((PVOID)ppBuffer,(iCount + 10),(PAG_COMMIT | PAG_READ | PAG_WRITE))) != NO_ERROR)    {    if (hwnd != NULLHANDLE)      {      sprintf(szMessage,"Unable to Allocate memory to read %s - %u",szFileSpec,rc);      MessageBox(HWND_DESKTOP,szMessage);      }    iCount = 0;    }  if (DosRead(hFile,(PVOID)*ppBuffer,iCount,(ULONG *)&iCount) != 0)    {    DosFreeMem(*ppBuffer);    iCount = 0;    }  else    {    /*    ** ignore/remove EOF character, if present    */    if ((*ppBuffer)[(iCount) - 1] == '/x1a')      iCount--;    /*    **  Add LF and CR to end of file, if not already there    */    if ((*ppBuffer)[iCount - 1] != '/x0a')      {      (*ppBuffer)[(iCount)++] = '/x0d';      (*ppBuffer)[(iCount)++] = '/x0a';      }    }  DosClose(hFile);  return(iCount);  }
开发者ID:OS2World,项目名称:APP-COMM-ComScope,代码行数:53,


示例21: fini

static void fini( TIMESTAMP *time ){    ULONG     rc;    ULONG     bytes;    DosRead( timerHandle, &stopTime, sizeof( TIMESTAMP ), &bytes );    calc_time( time, &startTime, &stopTime, &overHead );    rc = DosClose( timerHandle );    if( rc != 0 ) {        printf( "Could not close WTIMER$/n" );    }}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:12,


示例22: LocalRead

unsigned LocalRead( sys_handle filehndl, void *ptr, unsigned len ){    USHORT      read;    USHORT      ret;    ret = DosRead( filehndl, ptr, len, &read );    if( ret != 0 ) {        StashErrCode( ret, OP_LOCAL );        return( ERR_RETURN );    }    return( read );}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:12,


示例23: read

int read(int fd, void *buffer, unsigned int count){  APIRET   rc;  ULONG    actual;  rc= DosRead( fd, (PVOID) buffer, count, &actual);  if (!rc)    return( actual);				/* NO_ERROR */  _OS2errno( rc);				/* set errno */  return(-1);					/* read failed */}
开发者ID:OPSF,项目名称:uClinux,代码行数:12,


示例24: pipeClose

static VOID pipeClose( HPIPE hpipe ){#if 0    USHORT usIndex;    ULONG  cbActual;    // wait acknowledgement    DosRead( hpipe, &usIndex, sizeof( USHORT ), &cbActual );#endif    DosClose( hpipe );}
开发者ID:OS2World,项目名称:UTIL-SHELL-KShell,代码行数:12,


示例25: LocalRead

unsigned LocalRead(sys_handle filehndl, void *ptr, unsigned len){    ULONG       read;    APIRET      ret;    ret = DosRead(filehndl, ptr, len, &read);    if (ret != 0) {        StashErrCode(ret, OP_LOCAL);        return ERR_RETURN;    }    return read;}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:12,


示例26: multiRead

INT multiRead(CHAR *inFile, INT datS, INT sizeF, INT recNum){struct Samp   {   SHORT indx;   CHAR noteName[NAMESIZE];   }sample;ULONG oneRecSize, start;APIRET apiret;ULONG ulAction, ulBufferSize, ulBytesRead, newP;HFILE hfile;ulBufferSize = sizeF;apiret = DosOpen(inFile,		 &hfile,		 &ulAction,		 ulBufferSize,		 FILE_NORMAL,		 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,		 OPEN_ACCESS_READONLY | OPEN_SHARE_DENYWRITE | OPEN_FLAGS_SEQUENTIAL,		 NULL);oneRecSize = sizeof(sample) + sizeF;start = sizeof(recIndex);DosSetFilePtr(hfile, start+(oneRecSize*(recNum)), FILE_BEGIN, &newP);DosRead (hfile, &sample, sizeof(sample), &ulBytesRead);if( datS == 1 )   {   DosRead (hfile, &dataRecs.noteText, sizeF, &ulBytesRead);   dataRecs.indx = sample.indx;   strcpy(dataRecs.noteName, sample.noteName);   }else   {   DosRead (hfile, &dataR.noteText, sizeF, &ulBytesRead);   dataR.indx = sample.indx;   strcpy(dataR.noteName, sample.noteName);   }DosClose(hfile);return(1);}
开发者ID:OS2World,项目名称:APP-DATABASE-Datapad,代码行数:40,


示例27: FileReadFile

ULONG       FileReadFile( HFILE hFile, char * pBuf, ULONG cbRequest, char * path){    ULONG   rc;    ULONG   ul;    ULONG   ulRtn;do {    ulRtn = 0;    rc = DosRead( hFile, pBuf, cbRequest, &ulRtn);    if (!rc && ulRtn == cbRequest)        break;    printf( "FileReadFile - first attempt - rc= 0x%lx  request= 0x%lx  read= 0x%lx/n   file= %s/n",            rc, cbRequest, ulRtn, path);    DosSleep( 100);    rc = DosSetFilePtr( hFile, -(ulRtn), FILE_CURRENT, &ul);    if (rc) {        printf( "FileReadFile - DosSetFilePtr - rc= 0x%lx/n", rc);        ulRtn = 0;        break;    }    ulRtn = 0;    rc = DosRead( hFile, pBuf, cbRequest, &ulRtn);    if (!rc && ulRtn == cbRequest)        break;    printf( "FileReadFile - second attempt - rc= 0x%lx  request= 0x%lx  read= 0x%lx/n",            rc, cbRequest, ulRtn);    ulRtn = 0;} while (0);    return (ulRtn);}
开发者ID:OS2World,项目名称:APP-GRAPHICS-Cameraderie,代码行数:40,


示例28: __qread

int __qread( int handle, void *buffer, unsigned len ){#if defined( __NT__ )    DWORD           amount_read;#elif defined(__OS2__)    OS_UINT         amount_read;    APIRET          rc;#else    unsigned        amount_read;    tiny_ret_t      rc;#endif    __handle_check( handle, -1 );#ifdef DEFAULT_WINDOWING    if( _WindowsStdin != NULL ) {        LPWDATA res;        res = _WindowsIsWindowedHandle( handle );        if( res ) {            int rt;            rt = _WindowsStdin( res, buffer, len );            return( rt );        }    }#endif#if defined(__NT__)    if( !ReadFile( __getOSHandle( handle ), buffer, len, &amount_read, NULL ) ) {        DWORD       err;        err = GetLastError();        __set_errno_dos( err );        if( err != ERROR_BROKEN_PIPE || amount_read != 0 ) {            return( -1 );        }    }#elif defined(__OS2__)    rc = DosRead( handle, buffer, len, &amount_read );    if( rc ) {        return( __set_errno_dos( rc ) );    }#else  #if defined( __WINDOWS_386__ )    rc = __TinyRead( handle, buffer, len );  #else    rc = TinyRead( handle, buffer, len );  #endif    if( TINY_ERROR( rc ) ) {        return( __set_errno_dos( TINY_INFO( rc ) ) );    }    amount_read = TINY_LINFO( rc );#endif    return( amount_read );}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:52,



注:本文中的DosRead函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ DosReleaseMutexSem函数代码示例
C++ DosQueryProcAddr函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。