• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ MSVCRT__errno函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: strncpy_s

/*********************************************************************
 *		strncpy_s ([email protected])
 */
int CDECL strncpy_s(char *dest, MSVCRT_size_t numberOfElements,
        const char *src, MSVCRT_size_t count)
{
    MSVCRT_size_t i, end;

    TRACE("(%s %lu %s %lu)\n", dest, numberOfElements, src, count);

    if(!count)
        return 0;

    if(!dest || !src || !numberOfElements) {
        MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0);
        *MSVCRT__errno() = MSVCRT_EINVAL;
        return MSVCRT_EINVAL;
    }

    if(count!=MSVCRT__TRUNCATE && count<numberOfElements)
        end = count;
    else
        end = numberOfElements-1;

    for(i=0; i<end && src[i]; i++)
        dest[i] = src[i];

    if(!src[i] || end==count || count==MSVCRT__TRUNCATE) {
        dest[i] = '\0';
        return 0;
    }

    MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0);
    dest[0] = '\0';
    *MSVCRT__errno() = MSVCRT_EINVAL;
    return MSVCRT_EINVAL;
}
开发者ID:pstrealer,项目名称:wine,代码行数:37,代码来源:heap.c


示例2: MSVCRT__get_tzname

/*********************************************************************
 *		_get_tzname ([email protected])
 */
int CDECL MSVCRT__get_tzname(MSVCRT_size_t *ret, char *buf, MSVCRT_size_t bufsize, int index)
{
    char *timezone;

    switch(index)
    {
    case 0:
        timezone = tzname_std;
        break;
    case 1:
        timezone = tzname_dst;
        break;
    default:
        *MSVCRT__errno() = MSVCRT_EINVAL;
        return MSVCRT_EINVAL;
    }

    if(!ret || (!buf && bufsize > 0) || (buf && !bufsize))
    {
        *MSVCRT__errno() = MSVCRT_EINVAL;
        return MSVCRT_EINVAL;
    }

    *ret = strlen(timezone)+1;
    if(!buf && !bufsize)
        return 0;

    strcpy(buf, timezone);
    return 0;
}
开发者ID:mikekap,项目名称:wine,代码行数:33,代码来源:time.c


示例3: MSVCRT__wgetdcwd

/*********************************************************************
 *		_wgetdcwd ([email protected])
 *
 * Unicode version of _wgetdcwd.
 */
MSVCRT_wchar_t* CDECL MSVCRT__wgetdcwd(int drive, MSVCRT_wchar_t * buf, int size)
{
  static MSVCRT_wchar_t* dummy;

  TRACE(":drive %d(%c), size %d\n",drive, drive + 'A' - 1, size);

  if (!drive || drive == MSVCRT__getdrive())
    return MSVCRT__wgetcwd(buf,size); /* current */
  else
  {
    MSVCRT_wchar_t dir[MAX_PATH];
    MSVCRT_wchar_t drivespec[4] = {'A', ':', '\\', 0};
    int dir_len;

    drivespec[0] += drive - 1;
    if (GetDriveTypeW(drivespec) < DRIVE_REMOVABLE)
    {
      *MSVCRT__errno() = MSVCRT_EACCES;
      return NULL;
    }

    dir_len = GetFullPathNameW(drivespec,MAX_PATH,dir,&dummy);
    if (dir_len >= size || dir_len < 1)
    {
      *MSVCRT__errno() = MSVCRT_ERANGE;
      return NULL; /* buf too small */
    }

    TRACE(":returning %s\n", debugstr_w(dir));
    if (!buf)
      return MSVCRT__wcsdup(dir); /* allocate */
    strcpyW(buf,dir);
  }
  return buf;
}
开发者ID:AlexSteel,项目名称:wine,代码行数:40,代码来源:dir.c


示例4: _localtime64_s

/*********************************************************************
 *      _localtime64_s ([email protected])
 */
int CDECL _localtime64_s(struct MSVCRT_tm *time, const MSVCRT___time64_t *secs)
{
    struct tm *tm;
    time_t seconds;

    if (!time || !secs || *secs < 0 || *secs > _MAX__TIME64_T)
    {
        if (time)
            write_invalid_msvcrt_tm(time);

        *MSVCRT__errno() = MSVCRT_EINVAL;
        return MSVCRT_EINVAL;
    }

    seconds = *secs;

    _mlock(_TIME_LOCK);
    if (!(tm = localtime(&seconds)))
    {
        _munlock(_TIME_LOCK);
        *MSVCRT__errno() = MSVCRT_EINVAL;
        return MSVCRT_EINVAL;
    }

    unix_tm_to_msvcrt(time, tm);
    _munlock(_TIME_LOCK);
    return 0;
}
开发者ID:mikekap,项目名称:wine,代码行数:31,代码来源:time.c


示例5: _strlwr_s_l

/*********************************************************************
 *		_strlwr_s_l ([email protected])
 */
int CDECL _strlwr_s_l(char *str, MSVCRT_size_t len, MSVCRT__locale_t locale)
{
    char *ptr = str;

    if (!str || !len)
    {
        *MSVCRT__errno() = MSVCRT_EINVAL;
        return MSVCRT_EINVAL;
    }

    while (len && *ptr)
    {
        len--;
        ptr++;
    }

    if (!len)
    {
        str[0] = '\0';
        *MSVCRT__errno() = MSVCRT_EINVAL;
        return MSVCRT_EINVAL;
    }

    while (*str)
    {
        *str = MSVCRT__tolower_l((unsigned char)*str, locale);
        str++;
    }

    return 0;
}
开发者ID:PatroxGaurab,项目名称:wine,代码行数:34,代码来源:string.c


示例6: MSVCRT__wcsupr_s_l

/******************************************************************
 *		_wcsupr_s_l ([email protected])
 */
int CDECL MSVCRT__wcsupr_s_l( MSVCRT_wchar_t* str, MSVCRT_size_t n,
   MSVCRT__locale_t locale )
{
  MSVCRT_wchar_t* ptr = str;

  if (!str || !n)
  {
    if (str) *str = '\0';
    *MSVCRT__errno() = MSVCRT_EINVAL;
    return MSVCRT_EINVAL;
  }

  while (n--)
  {
    if (!*ptr) return 0;
    /* FIXME: add locale support */
    *ptr = toupperW(*ptr);
    ptr++;
  }

  /* MSDN claims that the function should return and set errno to
   * ERANGE, which doesn't seem to be true based on the tests. */
  *str = '\0';
  *MSVCRT__errno() = MSVCRT_EINVAL;
  return MSVCRT_EINVAL;
}
开发者ID:bpowers,项目名称:wine,代码行数:29,代码来源:wcs.c


示例7: memmove_s

/*********************************************************************
 *		memmove_s ([email protected])
 */
int CDECL memmove_s(void *dest, MSVCRT_size_t numberOfElements, const void *src, MSVCRT_size_t count)
{
    TRACE("(%p %lu %p %lu)\n", dest, numberOfElements, src, count);

    if(!count)
        return 0;

    if(!dest || !src) {
        if(dest)
            memset(dest, 0, numberOfElements);

        *MSVCRT__errno() = MSVCRT_EINVAL;
        return MSVCRT_EINVAL;
    }

    if(count > numberOfElements) {
        memset(dest, 0, numberOfElements);

        *MSVCRT__errno() = MSVCRT_ERANGE;
        return MSVCRT_ERANGE;
    }

    memmove(dest, src, count);
    return 0;
}
开发者ID:pstrealer,项目名称:wine,代码行数:28,代码来源:heap.c


示例8: MSVCRT___wcserror_s

/**********************************************************************
 *		__wcserror_s	([email protected])
 */
int CDECL MSVCRT___wcserror_s(MSVCRT_wchar_t* buffer, MSVCRT_size_t nc, const MSVCRT_wchar_t* str)
{
    int err;
    static const WCHAR colonW[] = {':', ' ', '\0'};
    static const WCHAR nlW[] = {'\n', '\0'};
    size_t len;

    err = *MSVCRT__errno();
    if (err < 0 || err > MSVCRT__sys_nerr) err = MSVCRT__sys_nerr;

    len = MultiByteToWideChar(CP_ACP, 0, MSVCRT__sys_errlist[err], -1, NULL, 0) + 1 /* \n */;
    if (str && *str) len += lstrlenW(str) + 2 /* ': ' */;
    if (len > nc)
    {
        MSVCRT_INVALID_PMT("buffer[nc] is too small", MSVCRT_ERANGE);
        return MSVCRT_ERANGE;
    }
    if (str && *str)
    {
        lstrcpyW(buffer, str);
        lstrcatW(buffer, colonW);
    }
    else buffer[0] = '\0';
    len = lstrlenW(buffer);
    MultiByteToWideChar(CP_ACP, 0, MSVCRT__sys_errlist[err], -1, buffer + len, 256 - len);
    lstrcatW(buffer, nlW);

    return 0;
}
开发者ID:ccpgames,项目名称:wine,代码行数:32,代码来源:errno.c


示例9: _cwait

/*********************************************************************
 *		_cwait ([email protected])
 */
MSVCRT_intptr_t CDECL _cwait(int *status, MSVCRT_intptr_t pid, int action)
{
  HANDLE hPid = (HANDLE)pid;
  int doserrno;

  action = action; /* Remove warning */

  if (!WaitForSingleObject(hPid, INFINITE))
  {
    if (status)
    {
      DWORD stat;
      GetExitCodeProcess(hPid, &stat);
      *status = (int)stat;
    }
    return pid;
  }
  doserrno = GetLastError();

  if (doserrno == ERROR_INVALID_HANDLE)
  {
    *MSVCRT__errno() =  MSVCRT_ECHILD;
    *MSVCRT___doserrno() = doserrno;
  }
  else
    msvcrt_set_errno(doserrno);

  return status ? *status = -1 : -1;
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:32,代码来源:process.c


示例10: MSVCRT_malloc

/*********************************************************************
 *                  malloc ([email protected])
 */
void* CDECL MSVCRT_malloc(MSVCRT_size_t size)
{
  void *ret = msvcrt_heap_alloc(0, size);
  if (!ret)
      *MSVCRT__errno() = MSVCRT_ENOMEM;
  return ret;
}
开发者ID:iXit,项目名称:wine,代码行数:10,代码来源:heap.c


示例11: MSVCRT_malloc

/*********************************************************************
 *                  malloc ([email protected])
 */
void* CDECL MSVCRT_malloc(MSVCRT_size_t size)
{
  void *ret = HeapAlloc(GetProcessHeap(),0,size);
  if (!ret)
      *MSVCRT__errno() = MSVCRT_ENOMEM;
  return ret;
}
开发者ID:pstrealer,项目名称:wine,代码行数:10,代码来源:heap.c


示例12: _wstrtime_s

/*********************************************************************
 *              _wstrtime_s ([email protected])
 */
int CDECL _wstrtime_s(MSVCRT_wchar_t* time, MSVCRT_size_t size)
{
    if(time && size)
        time[0] = '\0';

    if(!time) {
        *MSVCRT__errno() = MSVCRT_EINVAL;
        return MSVCRT_EINVAL;
    }

    if(size < 9) {
        *MSVCRT__errno() = MSVCRT_ERANGE;
        return MSVCRT_ERANGE;
    }

    _wstrtime(time);
    return 0;
}
开发者ID:mikekap,项目名称:wine,代码行数:21,代码来源:time.c


示例13: _wstrdate_s

/**********************************************************************
 *              _wstrdate_s ([email protected])
 */
int CDECL _wstrdate_s(MSVCRT_wchar_t* date, MSVCRT_size_t size)
{
    if(date && size)
        date[0] = '\0';

    if(!date) {
        *MSVCRT__errno() = MSVCRT_EINVAL;
        return MSVCRT_EINVAL;
    }

    if(size < 9) {
        *MSVCRT__errno() = MSVCRT_ERANGE;
        return MSVCRT_ERANGE;
    }

    _wstrdate(date);
    return 0;
}
开发者ID:mikekap,项目名称:wine,代码行数:21,代码来源:time.c


示例14: MSVCRT_rand_s

/*********************************************************************
 *		rand_s ([email protected])
 */
int CDECL MSVCRT_rand_s(unsigned int *pval)
{
    if (!pval || !RtlGenRandom(pval, sizeof(*pval)))
    {
        *MSVCRT__errno() = MSVCRT_EINVAL;
        return MSVCRT_EINVAL;
    }
    return 0;
}
开发者ID:AlexSteel,项目名称:wine,代码行数:12,代码来源:misc.c


示例15: MSVCRT__ctime32_s

/*********************************************************************
 *		_ctime32_s ([email protected])
 */
int CDECL MSVCRT__ctime32_s(char *res, MSVCRT_size_t len, const MSVCRT___time32_t *time)
{
    struct MSVCRT_tm *t;
    if( !MSVCRT_CHECK_PMT( res != NULL ) || !MSVCRT_CHECK_PMT( len >= 26 ) )
    {
        *MSVCRT__errno() = MSVCRT_EINVAL;
        return MSVCRT_EINVAL;
    }
    res[0] = '\0';
    if( !MSVCRT_CHECK_PMT( time != NULL ) || !MSVCRT_CHECK_PMT( *time > 0 ) )
    {
        *MSVCRT__errno() = MSVCRT_EINVAL;
        return MSVCRT_EINVAL;
    }
    t = MSVCRT__localtime32( time );
    strcpy( res, MSVCRT_asctime( t ) );
    return 0;
}
开发者ID:mikekap,项目名称:wine,代码行数:21,代码来源:time.c


示例16: MSVCRT__ftime32_s

/*********************************************************************
 *		_ftime32_s ([email protected])
 */
int CDECL MSVCRT__ftime32_s(struct MSVCRT___timeb32 *buf)
{
    if( !MSVCRT_CHECK_PMT( buf != NULL ) )
    {
        *MSVCRT__errno() = MSVCRT_EINVAL;
        return MSVCRT_EINVAL;
    }
    MSVCRT__ftime32(buf);
    return 0;
}
开发者ID:mikekap,项目名称:wine,代码行数:13,代码来源:time.c


示例17: MSVCRT_calloc

/*********************************************************************
 *		calloc ([email protected])
 */
void* CDECL DECLSPEC_HOTPATCH MSVCRT_calloc(MSVCRT_size_t count, MSVCRT_size_t size)
{
  MSVCRT_size_t bytes = count*size;

  if (size && bytes / size != count)
  {
    *MSVCRT__errno() = MSVCRT_ENOMEM;
    return NULL;
  }

  return msvcrt_heap_alloc(HEAP_ZERO_MEMORY, bytes);
}
开发者ID:iXit,项目名称:wine,代码行数:15,代码来源:heap.c


示例18: MSVCRT__findnexti64

/*********************************************************************
 *		_findnexti64 ([email protected])
 *
 * 64-bit version of _findnext.
 */
int CDECL MSVCRT__findnexti64(MSVCRT_intptr_t hand, struct MSVCRT__finddatai64_t * ft)
{
  WIN32_FIND_DATAA find_data;

  if (!FindNextFileA((HANDLE)hand, &find_data))
  {
    *MSVCRT__errno() = MSVCRT_ENOENT;
    return -1;
  }

  msvcrt_fttofdi64(&find_data,ft);
  return 0;
}
开发者ID:AlexSteel,项目名称:wine,代码行数:18,代码来源:dir.c


示例19: MSVCRT__wfindnexti64

/*********************************************************************
 *		_wfindnexti64 ([email protected])
 *
 * Unicode version of _findnexti64.
 */
int CDECL MSVCRT__wfindnexti64(long hand, struct MSVCRT__wfinddatai64_t * ft)
{
  WIN32_FIND_DATAW find_data;

  if (!FindNextFileW((HANDLE)hand, &find_data))
  {
    *MSVCRT__errno() = MSVCRT_ENOENT;
    return -1;
  }

  msvcrt_wfttofdi64(&find_data,ft);
  return 0;
}
开发者ID:howard5888,项目名称:wineT,代码行数:18,代码来源:dir.c


示例20: _aligned_offset_malloc

/*********************************************************************
 *		_aligned_offset_malloc ([email protected])
 */
void * CDECL _aligned_offset_malloc(MSVCRT_size_t size, MSVCRT_size_t alignment, MSVCRT_size_t offset)
{
    void *memblock, *temp, **saved;
    TRACE("(%lu, %lu, %lu)\n", size, alignment, offset);

    /* alignment must be a power of 2 */
    if ((alignment & (alignment - 1)) != 0)
    {
        *MSVCRT__errno() = MSVCRT_EINVAL;
        return NULL;
    }

    /* offset must be less than size */
    if (offset >= size)
    {
        *MSVCRT__errno() = MSVCRT_EINVAL;
        return NULL;
    }

    /* don't align to less than void pointer size */
    if (alignment < sizeof(void *))
        alignment = sizeof(void *);

    /* allocate enough space for void pointer and alignment */
    temp = MSVCRT_malloc(size + alignment + sizeof(void *));

    if (!temp)
        return NULL;

    /* adjust pointer for proper alignment and offset */
    memblock = ALIGN_PTR(temp, alignment, offset);

    /* Save the real allocation address below returned address */
    /* so it can be found later to free. */
    saved = SAVED_PTR(memblock);
    *saved = temp;

    return memblock;
}
开发者ID:pstrealer,项目名称:wine,代码行数:42,代码来源:heap.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MTP_SOURCE_GET_PRIVATE函数代码示例发布时间:2022-05-30
下一篇:
C++ MSToSec函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap