在vc里用fopen("log.txt","a")当log.txt存在时GetLastError返回183
解决方案 »
- 如何让窗口大小固定不变呢?
- 窗口布局问题
- vc++运行的问题
- 在VC6中能不能像VB6那样,生成ActiveX DLL那样的类库?
- 菜鸟请教一个关于打印预览简单的问题~
- 谁能写一个1000字节以下的WINDOWS程序?
- 大家帮忙看看这个socket怎么就绑定不了呢
- 如果你有 MSDN的一个例子 drawcli, 麻烦你帮我看看下面这个问题, 多谢!
- 请问在vc++6.0新建项目里(new)的工程区(project)中,有一项是Makefile,它是做什么用的 ,又相关的资料吗?,急急急!倾囊相送!!
- Visual Studio 2010提示 不能打开初始化文件BDBKLIST.ini
- 急急急 怎么把EXCEL中的数据或者ACCESS中的数据导入数组中??
- 串口自动清空
fopen("log.txt","a+")
183返回值表示
ERROR_ALREADY_EXISTS
Cannot create a file when that file already exists.
* and "data2".It uses fclose to close "data" and
* _fcloseall to close all remaining files.
*/#include <stdio.h>FILE *stream, *stream2;void main( void )
{
int numclosed; /* Open for read (will fail if file "data" does not exist) */
if( (stream = fopen( "data", "r" )) == NULL )
printf( "The file 'data' was not opened\n" );
else
printf( "The file 'data' was opened\n" ); /* Open for write */
if( (stream2 = fopen( "data2", "w+" )) == NULL )
printf( "The file 'data2' was not opened\n" );
else
printf( "The file 'data2' was opened\n" ); /* Close stream */
if( fclose( stream ) )
printf( "The file 'data' was not closed\n" ); /* All other files are closed: */
numclosed = _fcloseall( );
printf( "Number of files closed by _fcloseall: %u\n", numclosed );
}
所以说,不存在1楼所说的问题。
//直接用CreateFile看看。