I have issues understanding the GetWindowTextA() function from the Win32 API.
According to the Microsoft documentation, nMaxCount is the maximum characters to copy to buffer lpString including the null character.
So, does GetWindowTextA() automatically write the null termination character into to buffer lpString or do I have to manually add the null termination character into lpString?
This is the GetWindowTextA() definition from Microsoft Documentation:
int GetWindowTextA(
[in] HWND hWnd,
[out] LPSTR lpString,
[in] int nMaxCount
);
Here is the code:
char M_Buff[20];
SetWindowTextA(M_SEND_EDIT_TEXT,"Hello World");
GetWindowTextA(M_SEND_EDIT_TEXT,M_Buff,20); //Do i have to add the null termination caracter into M_Buff myself or it is put automatically ?
printf("String is %s\n",M_Buff);