Pelles C forum

Pelles C => Bug reports => Topic started by: Fuerst on January 03, 2023, 08:06:18 PM

Title: tchar.h: _tfreopen() maps to unknown function reopen() _UNICODE not defined
Post by: Fuerst on January 03, 2023, 08:06:18 PM
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) ...
Title: Re: tchar.h: _tfreopen() maps to unknown function reopen() _UNICODE not defined
Post by: frankie on January 04, 2023, 09:27:15 AM
I think, there simply is the letter "f" missing in front of "reopen" (The Help-File is  affected although) ...

Me too...  ;)
Title: Re: tchar.h: _tfreopen() maps to unknown function reopen() _UNICODE not defined
Post by: Pelle on March 05, 2023, 04:40:30 PM
Yup.