I have a program in C that have been working fine since I compiled it in an earlier version of Visual Express. Now that I have been compiling it in Visual Studio 2022, the fwscanf_s function doesn't work properly. It reads text and integers. The integers are displayed properly, but not the text variable.
struct svaras
{
TCHAR name[20];
int t;
int rk[2];
int rk2[2];
int rs[2];
int rs2[2];
};
struct svaras scales[150];
i = 0;
if(_waccess_s(L"shrutilist.dat", 0) != -1){
Receivedata = GetModuleFileName(NULL, Buffer, MAX_PATH);
PathCchRemoveFileSpec(Buffer, MAX_PATH);
PathCchAppend(Buffer, MAX_PATH, L"shrutilist.dat");
err = _wfopen_s(&shrutiliste, Buffer, L"r");
while (i < 60) {
test = fwscanf_s(shrutiliste, "%20ls %i %i %i %i %i \n",
scales[i].name,
&scales[i].t,
&scales[i].rk[0], &scales[i].rk[1],
&scales[i].rk2[0], &scales[i].rk2[1],
&scales[i].rs[0], &scales[i].rs[1],
&scales[i].rs2[0], &scales[i].rs2[1]);
++1;
}
fclose(shrutiliste);
}
The variable scales[i].name shows this in the debugger:
{name=0x006fb9fc L"쳌쳌쳌쳌쳌쳌쳌쳌쳌쳌쳌쳌쳌쳌쳌쳌쳌쳌쳌쳌... t=-858993460 rk=0x006fba28 {-858993460, -858993460}
While when it is displayed in a list box, it only shows this: 쳌쳌쳌쳌쳌쳌쳌쳌쳌
The integers are displayed correctly in the list box.
Thanks in advance.