当前位置: 首页>>代码示例>>C++>>正文


C++ DosWrite函数代码示例

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


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

示例1: vioShowBuf

static ULONG vioShowBuf( USHORT usIndex, PVOID pargs )
{
    PVIOSHOWBUFPARAM p = pargs;

    HPIPE   hpipe;
    ULONG   cbActual;

    CALL_VIO( VioShowBuf, p->usOfs, p->usLen, p->hvio );

    if( m_LVBPtr )
    {
        USHORT  usStart = p->usOfs & -2;
        USHORT  usEnd = ( p->usOfs + p->usLen + 1 ) & -2;
        USHORT  usLen;

        if( usEnd > m_LVBLen )
            usEnd = m_LVBLen;

        usLen = usEnd - usStart;

        pipeOpen( &hpipe );

        DosWrite( hpipe, &usIndex, sizeof( USHORT ), &cbActual );
        DosWrite( hpipe, &usStart, sizeof( USHORT ), &cbActual );
        DosWrite( hpipe, &usLen, sizeof( USHORT ), &cbActual );
        DosWrite( hpipe, m_LVBPtr + usStart, usLen, &cbActual );

        pipeClose( hpipe );
    }

    return 0;
}
开发者ID:OS2World,项目名称:UTIL-SHELL-KShell,代码行数:32,代码来源:viosub.c

示例2: Krnl_Debug_Log

// Title и String - строки, которые надо записать.
VOID Krnl_Debug_Log( PCHAR Title, PCHAR String )
{
 // Если файла нет - создаем его.
 HFILE File = NULLHANDLE; ULONG Report = 0; ULONG New_size = 0; PEAOP2 EAs = NULL;

 ULONG Action = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
 ULONG Mode = OPEN_FLAGS_FAIL_ON_ERROR | OPEN_SHARE_DENYWRITE | OPEN_ACCESS_WRITEONLY;

 CHAR Log_file_name[ SIZE_OF_PATH ] = "";
 GetCurrentPath( Log_file_name ); strcat( Log_file_name, "\\_log.txt" );

 DosOpen( Log_file_name, &File, &Report, New_size, FILE_COMMON_ATTRIBUTES, Action, Mode, EAs );

 // Записываем строку.
 if( Report != FILE_CREATED )
  {
   DosSetFilePtr( File, 0, FILE_END, &Report );
   DosWrite( File, "\n", strlen( "\n" ), &Report );
  }

 if( Title[ 0 ] != 0 )
  {
   DosWrite( File, Title, strlen( Title ), &Report );
   DosWrite( File, ": ", strlen( ": " ), &Report );
  }

 DosWrite( File, String, strlen( String ), &Report );

 // Закрываем файл.
 DosClose( File ); File = NULLHANDLE;

 // Возврат.
 return;
}
开发者ID:OS2World,项目名称:UTIL-WPS-Nice_OS2_Enhancer,代码行数:35,代码来源:Debug_code.cpp

示例3: main

void main(void) {
  APIRET rc; PVOID myhighmem; ULONG cbWritten;
  rc = DosWrite(HF_STDOUT,"Hello World!\r\n",14,&cbWritten);
  rc = DosAllocMem(&myhighmem, 1024*1024*1024, PAG_READ|PAG_WRITE | OBJ_ANY );  // allocate 1GB of HMA(obj_any) rw-able 
  if(rc==0) { rc = DosWrite(HF_STDOUT,"allocation ok.!\r\n",17,&cbWritten);
    rc = DosFreeMem(myhighmem);
  }
  DosExit(EXIT_PROCESS,rc);
}
开发者ID:OS2World,项目名称:UTIL-MISC-Elmar-s_Command_Utilites,代码行数:9,代码来源:indirect3.c

示例4: os_write

static int os_write( int handle, const void *buffer, unsigned len, unsigned *amt )
/********************************************************************************/
{
#ifdef DEFAULT_WINDOWING
    LPWDATA     res;
#endif
#if defined(__NT__)
    HANDLE      h;
    int         rc;
#else
    tiny_ret_t  rc;
#endif

    rc = 0;
#ifdef DEFAULT_WINDOWING
    if( _WindowsStdout != 0 && (res = _WindowsIsWindowedHandle( handle )) != 0 ) {
        *amt = _WindowsStdout( res, buffer, len );
    } else
#endif
    {
#if defined(__NT__)
        h = __getOSHandle( handle );
        if( !WriteFile( h, (LPCVOID)buffer, (DWORD)len, (LPDWORD)amt, NULL ) ) {
            rc = __set_errno_nt();
        }
#elif defined(__OS2_286__)
        rc = DosWrite( handle, (PVOID)buffer, (USHORT)len, (PUSHORT)amt );
#elif defined(__OS2__)
        rc = DosWrite( handle, (PVOID)buffer, (ULONG)len, (PULONG)amt );
#else
        rc = TinyWrite( handle, buffer, len );
        *amt = TINY_LINFO( rc );
        if( TINY_OK( rc ) ) {
            rc = 0;
        }
#endif
    }
#if !defined(__NT__)
    if( TINY_ERROR( rc ) ) {
        rc = __set_errno_dos( TINY_INFO( rc ) );
    }
#endif
    if( *amt != len ) {
        rc = ENOSPC;
        __set_errno( rc );
    }
    return( rc );
}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:48,代码来源:write.c

示例5: SendByte

void SendByte( int value )
{
    USHORT      written = 0;

    DosWrite( ComPort, (BYTE *)&value, 1, &written );
    if( !BlockTransmission ) WaitTransmit();
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:7,代码来源:seros2.c

示例6: _PR_MD_WRITE

PRInt32
_PR_MD_WRITE(PRFileDesc *fd, const void *buf, PRInt32 len)
{
    PRInt32 bytes;
    int rv; 

    rv = DosWrite((HFILE)fd->secret->md.osfd,
                  (PVOID)buf,
                  len,
                  (PULONG)&bytes);

    if (rv != NO_ERROR) 
    {
        _PR_MD_MAP_WRITE_ERROR(rv);
        return -1;
    }

    if (len != bytes) {
        rv = ERROR_DISK_FULL;
        _PR_MD_MAP_WRITE_ERROR(rv);
        return -1;
    }

    return bytes;
} /* --- end _PR_MD_WRITE() --- */
开发者ID:Akin-Net,项目名称:mozilla-central,代码行数:25,代码来源:os2io.c

示例7: blkwrite

/* Write the contents of buf into record # blkno, for the block file
 * identified by blkhandle.  Blocks are numbered starting at 0.  The
 * requested block may be past the end of the file, in which case
 * this function is expected to extend the file.
 */
void 
blkwrite (BLK    *buf,    /* buffer, holds contents of block */
          _BLKNO_  blkno) /* where to write it */
{
  LONG offset;
  ULONG actual;

#ifdef FEATURE_RAM
  /* store it in RAM */
  if (nblks > 0)
  {
    if (blkno >= nblks)
    {
      blklist = (BLK **)realloc(blklist,
            (nblks + 1024) * sizeof(BLK *));
      memset(&blklist[nblks], 0, 1024 * sizeof(BLK *));
      nblks += 1024;
    }
    if (!blklist[blkno])
      blklist[blkno] = malloc(o_blksize);
    memcpy(blklist[blkno], buf, o_blksize);
    return;
  }
#endif

  /* write the block */
  offset = (LONG)blkno * (LONG)o_blksize;
  if (DosSetFilePtr (fd, offset, FILE_BEGIN, &actual) != NO_ERROR
    || DosWrite (fd, buf, o_blksize, &actual) != NO_ERROR
    || actual != o_blksize)
  {
    msg (MSG_FATAL, "blkwrite(%d) failed", blkno);
  } /* if */
}
开发者ID:OS2World,项目名称:APP-EDITOR-elvis,代码行数:39,代码来源:osblock.c

示例8: SERIAL_sendchar

bool SERIAL_sendchar(COMPORT port, char data) {
	ULONG bytesWritten = 0;

	APIRET rc = DosWrite(port->porthandle, &data, 1, &bytesWritten);
	if (rc == NO_ERROR && bytesWritten > 0) return true;
	else return false;
}
开发者ID:GREYFOXRGR,项目名称:em-dosbox,代码行数:7,代码来源:libserial.cpp

示例9: system_End

/**
 * Cleans up after system_Init() and system_Configure().
 */
void system_End(void)
{
    if( tidIPCFirst == _gettid())
    {
        HPIPE hpipe;
        ULONG ulAction;
        ULONG cbActual;
        ULONG rc;

        do
        {
            rc = DosOpen( VLC_IPC_PIPE, &hpipe, &ulAction, 0, 0,
                          OPEN_ACTION_OPEN_IF_EXISTS,
                          OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYREADWRITE |
                          OPEN_FLAGS_FAIL_ON_ERROR,
                          NULL );

            if( rc == ERROR_PIPE_BUSY )
                DosWaitNPipe( VLC_IPC_PIPE, -1 );
            else if( rc )
                DosSleep( 1 );
        } while( rc );

        /* Ask for IPCHelper to quit */
        ULONG ulCmd = IPC_CMD_QUIT;
        DosWrite( hpipe, &ulCmd, sizeof( ulCmd ), &cbActual );

        DosClose( hpipe );

        TID tid = tidIPCHelper;
        DosWaitThread( &tid, DCWW_WAIT );
    }
}
开发者ID:etix,项目名称:vlc,代码行数:36,代码来源:specific.c

示例10: TRANS

static int
TRANS(Os2Write)(XtransConnInfo ciptr, char *buf, int size)
{
    int ret;
    APIRET rc;
    ULONG nWritten;
    PRMSG(2,"Os2Write(%d,%x,%d)\n", ciptr->fd, buf, size );
    rc = DosWrite(ciptr->fd, buf, size, &nWritten);
    if (rc == 0){
         ret = nWritten;
         if(nWritten == 0) {
                 errno=EAGAIN;
                 ret = -1;
                 }
         }
    else if ((rc == 39) || (rc == 112)){
        errno = EAGAIN;
        ret = -1;
        }
    else if ((rc == 109) || (rc == 230) || (rc == 233)){
        errno = EPIPE;
        ret = -1;
        }
    else if (rc == 6){
         errno=EBADF;
         ret = -1;
         }
    else {
        PRMSG(2,"(Os2Write)Unknown return code from DosWrite, fd %d rc=%d\n", ciptr->fd,rc,0 );
        errno = EINVAL;
        ret = -1;
        }
    return (ret);
}
开发者ID:HoMeCracKeR,项目名称:MacOSX-SDKs,代码行数:34,代码来源:Xtransos2.c

示例11: main

void main()
{
    USHORT rc, Action;
    HFILE FileHandle;

    DosSetSigHandler(BrkHandler, NULL, NULL, SIGA_ACCEPT, SIG_CTRLC);
    DosSetSigHandler(BrkHandler, NULL, NULL, SIGA_ACCEPT, SIG_KILLPROCESS);
    DosSetSigHandler(BrkHandler, NULL, NULL, SIGA_ACCEPT, SIG_CTRLBREAK);

    DosSetPrty(PRTYS_PROCESS, PRTYC_IDLETIME, 0, 0);

    rc = DosOpen("Idlehlt$", &FileHandle, &Action, 0L,
                 FILE_NORMAL, FILE_OPEN, OPEN_SHARE_DENYNONE, 0L);

    if(!rc) {
        while(!ExitWhile)
            DosDevIOCtl(NULL, NULL, 0x01, 0x91, FileHandle);
        DosClose(FileHandle);
    } else {
        char buf[6], Message[36] = "HLT Driver not installed? rc=";
        char *src = buf, *dst = &Message[29];
        int len;

        utoa(rc, buf, 10);
        while(*dst++ = *src++);
        len = dst - Message;
        Message[len-1] = '\r';
        Message[len] = '\n';

        DosWrite(STDERR_FILENO, Message, len+1, &Action);
    }
}
开发者ID:OS2World,项目名称:DRV-IDLEHLT16,代码行数:32,代码来源:idlehlt.c

示例12: SwitchBack

static void SwitchBack( void )
{
    USHORT      written;

    static pmhelp_packet data = { PMHELP_SWITCHBACK };
    DosWrite( OutStream, &data, sizeof( data ), &written );
}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:7,代码来源:pmhelp.c

示例13: fwrite

/****************************************************************************
REMARKS:
VDD implementation of the ANSI C fwrite function.
****************************************************************************/
size_t fwrite(
    void *ptr,
    size_t size,
    size_t n,
    FILE *f)
{
    char        *buf = ptr;
    int         bytes,writtenbytes,totalbytes = 0;

    /* Flush anything already in the buffer */
    if (!f->writemode)
	return 0;
    fflush(f);
    bytes = size * n;
    #ifdef __OS2_VDD__
    writtenbytes = VDHWrite((HFILE)f->handle, buf, bytes);
    #else
    DosWrite((HFILE)f->handle, buf, bytes, &writtenbytes);
    #endif
    totalbytes += writtenbytes;
    f->offset += writtenbytes;
    if (f->offset > f->filesize)
	f->filesize = f->offset;
    return totalbytes / size;
}
开发者ID:A1DEVS,项目名称:lenovo_a1_07_uboot,代码行数:29,代码来源:fileio.c

示例14: os2Write

/*
** Write data from a buffer into a file.  Return SQLITE_OK on success
** or some other error code on failure.
*/
static int os2Write(
  sqlite3_file *id,               /* File to write into */
  const void *pBuf,               /* The bytes to be written */
  int amt,                        /* Number of bytes to write */
  sqlite3_int64 offset            /* Offset into the file to begin writing at */
){
  ULONG fileLocation = 0L;
  APIRET rc = NO_ERROR;
  ULONG wrote;
  os2File *pFile = (os2File*)id;
  assert( id!=0 );
  SimulateIOError( return SQLITE_IOERR_WRITE );
  SimulateDiskfullError( return SQLITE_FULL );
  OSTRACE3( "WRITE %d lock=%d\n", pFile->h, pFile->locktype );
  if( DosSetFilePtr(pFile->h, offset, FILE_BEGIN, &fileLocation) != NO_ERROR ){
    return SQLITE_IOERR;
  }
  assert( amt>0 );
  while( amt > 0 &&
         ( rc = DosWrite( pFile->h, (PVOID)pBuf, amt, &wrote ) ) == NO_ERROR &&
         wrote > 0
  ){
    amt -= wrote;
    pBuf = &((char*)pBuf)[wrote];
  }

  return ( rc != NO_ERROR || amt > (int)wrote ) ? SQLITE_FULL : SQLITE_OK;
}
开发者ID:erik-knudsen,项目名称:eCos-enhancements,代码行数:32,代码来源:os_os2.c

示例15: 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,代码来源:DOSCL1.C


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