gpt4 book ai didi

c++ - 'fopen' 返回格式错误的 'fp'

转载 作者:太空宇宙 更新时间:2023-11-04 10:12:20 25 4
gpt4 key购买 nike

<分区>

环境

  • Ubuntu 16.x (x64)
  • C++

用例

    FILE* fp = 0;
if (ERROR_SUCCESS != stat(pFullPath, &st)) {
if (0 == (fp = fopen(pFullPath, "w+b")))// Create The File
return HRESULT_GET_ERRNO();
_ASSERT(0 != fileno(fp));

问题描述

fopen 总是成功返回一个有效的指针
偶尔‘fileno’返回零和m_pf->_fileno == 0

什么可能导致格式错误的“fp”?

'm_fp' 转储

_flags  -72539008   int
_IO_read_ptr 0x0 char *
_IO_read_end 0x0 char *
_IO_read_base 0x0 char *
_IO_write_base 0x0 char *
_IO_write_ptr 0x0 char *
_IO_write_end 0x0 char *
_IO_buf_base 0x0 char *
_IO_buf_end 0x0 char *
_IO_save_base 0x0 char *
_IO_backup_base 0x0 char *
_IO_save_end 0x0 char *
_markers 0x0 _IO_marker *
_chain 0x7fe6368cf540 <_IO_2_1_stderr_> _IO_FILE *
_fileno 0 int
_flags2 0 int
_old_offset 94543438232832 __off_t
_cur_column 0 unsigned short
_vtable_offset 7 '\a' signed char
_shortbuf char [1]
_lock x55fc9c068e50 _IO_lock_t *
_offset -1 __off64_t
__pad1 0x55fc9c070210 void *
__pad2 0x55fc9c068e60 void *
__pad3 0x0 void *
__pad4 0x7fe644d41a93 void *
__pad5 0 size_t
_mode 0 int
_unused2 char [20]

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com