``TCHAR finalpath[MAX_PATH];GetCurrentDirectory(MAX_PATH,finalpath);TCHAR filename[] = TEXT("\\lista.txt");wcscat(finalpath,filename);wprintf(L"List will be saved to %s", finalpath);``

So this basically confirms me that finalpath is indeed c:\somepath\lista.txt

but `_wfreopen(TEXT(finalpath),TEXT("w"),stdout);`

If i just change it to

``_wfreopen(TEXT("c:/somepath/lista.txt"),TEXT("w"),stdout);``

everything then works fine, why and how can i make it accept my finalpath arg?

Thanks

You don't use the TEXT macro with variables. I'm surprised that `_wfreopen(TEXT(finalpath),TEXT("w"),stdout);` even compiles.

Try `_wfreopen(finalpath,TEXT("w"),stdout);`

Top