Full code of mdi_unit.c:
http://pastebin.ca/337163The functions where the errors are in
BOOL LoadFile(HWND hEdit, LPSTR pszFileName)
{
HANDLE hFile;
BOOL bSuccess = FALSE;
hFile = CreateFile(pszFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwFileSize;
dwFileSize = GetFileSize(hFile, NULL);
if(dwFileSize != 0xFFFFFFFF)
{
LPSTR pszFileText = LPSTR(GlobalAlloc(GPTR, dwFileSize + 1));
if(pszFileText != NULL)
{
DWORD dwRead;
if(ReadFile(hFile, pszFileText, dwFileSize, &dwRead, NULL))
{
pszFileText[dwFileSize] = 0; // Null terminator
if(SetWindowText(hEdit, pszFileText))
bSuccess = TRUE; // It worked!
}
GlobalFree(pszFileText);
}
}
CloseHandle(hFile);
}
return bSuccess;
}
BOOL SaveFile(HWND hEdit, LPSTR pszFileName)
{
HANDLE hFile;
BOOL bSuccess = FALSE;
hFile = CreateFile(pszFileName, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit);
if(dwTextLength > 0)// No need to bother if there's no text.
{
LPSTR pszText=LPSTR(GlobalAlloc(GPTR, dwTextLength + 1));
if(pszText != NULL)
{
if(GetWindowText(hEdit, pszText, dwTextLength + 1))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
GlobalFree(pszText);
}
}
CloseHandle(hFile);
}
return bSuccess;
}
These are all build messages i get and i turned on full command line:
Project : Win32 Application
Compiler : GNU GCC Compiler (called directly)
Directory : C:\Program\CodeBlocks\PROJEKT\dslua sdk\
--------------------------------------------------------------------------------
Switching to target: default
mingw32-gcc.exe -IC:\Program\CodeBlocks\include -c mdi_unit.c -o .objs\mdi_unit.o
mdi_unit.c: In function `LoadFile':
mdi_unit.c:37: error: syntax error before "LPSTR"
mdi_unit.c: In function `SaveFile':
mdi_unit.c:68: error: syntax error before "LPSTR"
Process terminated with status 1 (0 minutes, 2 seconds)
2 errors, 0 warnings