首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

对于remove(), errno有哪些 ?解决思路

2013-10-23 
对于remove(), errno有哪些 ?如题!谢谢!!!!removeerrno[解决办法]errno 错误处理机制数学错误 :溢出ERANGE

对于remove(), errno有哪些 ?
如题!

谢谢!!!! remove errno
[解决办法]
errno 错误处理机制
数学错误 :溢出ERANGE 有效值丢失 域错误EDOM

定义错误 :<math.h>  <stdio.h> <stdlib.h>  <siganl.h>中函数出错  保存的errno

[解决办法]
相应定义错误查看 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>
[解决办法]
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

热点排行