user-0 提问: 对于remove()， errno有哪些 ？

回复:
user: user-1
content: C:\Program Files\Microsoft Visual Studio 10.0\VC\crt\src\unlink.c /*** *unlink.c - unlink a file * *       Copyright (c) Microsoft Corporation. All rights reserved. * *Purpose: *       defines unlink() - unlink a file * *******************************************************************************/  #include <cruntime.h> #include <oscalls.h> #include <internal.h> #include <io.h> #include <tchar.h>  /*** *int _unlink(path) - unlink(delete) the given file * *Purpose: *       This version deletes the given file because there is no *       distinction between a linked file and non-linked file. * *       NOTE: remove() is an alternative entry point to the _unlink() *       routine* interface is identical. * *Entry: *       _TSCHAR *path - file to unlink/delete * *Exit: *       returns 0 if successful *       returns -1 and sets errno if unsuccessful * *Exceptions: * *******************************************************************************/  int __cdecl _tremove (         const _TSCHAR *path         ) {         ULONG dosretval;          if (!DeleteFile((LPTSTR)path))             dosretval = GetLastError();         else             dosretval = 0;          if (dosretval) {             /* error occured -- map error code and return */             _dosmaperr(dosretval);             return -1;         }          return 0; }  int __cdecl _tunlink (         const _TSCHAR *path         ) {         /* remove is synonym for unlink */         return _tremove(path); }

user: user-1
content: remove, _wremove Delete a file.  int remove( const char *path );  int _wremove( const wchar_t *path );  Routine Required Header Compatibility  remove <stdio.h> or <io.h> ANSI, Win 95, Win NT  _wremove <stdio.h> or <wchar.h> Win NT    For additional compatibility information, see Compatibility in the Introduction.  Libraries  LIBC.LIB Single thread static library, retail version  LIBCMT.LIB Multithread static library, retail version  MSVCRT.LIB Import library for MSVCRT.DLL, retail version    Return Value  Each of these functions returns 0 if the file is successfully deleted. Otherwise, it returns –1 and sets errno either to EACCES to indicate that the path specifies a read-only file, or to ENOENT to indicate that the filename or path was not found or that the path specifies a directory. This function fails and returns -1 if the file is open.  Parameter  path  Path of file to be removed  Remarks  The remove function deletes the file specified by path. _wremove is a wide-character version of _remove; the path argument to _wremove is a wide-character string. _wremove and _remove behave identically otherwise. All handles to a file must be closed before it can be deleted.  Generic-Text Routine Mappings  TCHAR.H Routine  _UNICODE & _MBCS Not Defined _MBCS Defined _UNICODE Defined  _tremove remove remove _wremove    Example  /* REMOVE.C: This program uses remove to delete REMOVE.OBJ. */  #include <stdio.h>  void main( void ) {    if( remove( "remove.obj" ) == -1 )       perror( "Could not delete 'REMOVE.OBJ'" );    else       printf( "Deleted 'REMOVE.OBJ'\n" ); }   Output  Deleted 'REMOVE.OBJ'   File Handling Routines  See Also   _unlink

user: user-2
content: 相应定义错误查看 man page  相应函数的errno   remove  错误代码： 1、EROFS 欲写入的文件存在于只读文件系统内。 2、EFAULT 参数pathname 指针超出可存取内存空间。 3、ENAMETOOLONG 参数pathname 太长。 4、ENOMEM 核心内存不足。 5、ELOOP 参数pathname 有过多符号连接问题。 6、EIO I/O 存取错误。 <br />本文来自【C语言中文网】：<a href="http://see.xidian.edu.cn/cpp/html/322.html" target="_blank">http://see.xidian.edu.cn/cpp/html/322.html</a>

user: user-2
content: errno 错误处理机制 数学错误 ：溢出ERANGE 有效值丢失 域错误EDOM  定义错误 ：<math.h>  <stdio.h> <stdlib.h>  <siganl.h>中函数出错  保存的errno