NO

Author Topic: tchar.h: _tfreopen() maps to unknown function reopen() _UNICODE not defined  (Read 210 times)

Offline Fuerst

  • Member
  • *
  • Posts: 1
Pelles C 11.00.2
Code to reproduce ...

#undef _UNICODE
#include <stdio.h>
#include <wchar.h>
#include <tchar.h>

int _tmain( void ) {
   FILE *f = _tfreopen(_T("NUL:"), _T("w"), stdout);
   return 0;
}

Compiler-Output

> > pocc.exe -Tx64-coff -std:C99 -Ob1 -fp:precise -W2 -Gd -Go -GX "O:\Sources\test64\test64.c" -Fo"O:\Sources\test64\output\test64.obj"
O:\Sources\test64\test64.c(7): warning #2018: Undeclared function 'reopen' (did you mean: freopen?); assuming 'extern' returning 'int'.
O:\Sources\test64\test64.c(7): error #2082: Invalid initialization type; expected 'FILE (aka (incomplete) struct FILE) *' but found 'int'.
O:\Sources\test64\test64.c(7): error #2168: Operands of '=' have incompatible types 'FILE (aka (incomplete) struct FILE) *' and 'int'.
*** Error code: 1 ***
Done.

tchar.h Line 360

/* file access */
#define _tfdopen  _fdopen  /* 05-07-18 */
#define _tfopen  fopen  /* 05-07-18 */
#define _tfreopen  reopen  /* 05-07-18 */  <<< Line 360

I think, there simply is the letter "f" missing in front of "reopen" (The Help-File is  affected although) ...

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 1940
I think, there simply is the letter "f" missing in front of "reopen" (The Help-File is  affected although) ...

Me too...  ;)