Vervoortje
Technical User
i'm programming in MFC and when i compile i have 0 errors and 0 warnings !
But when i run the program it crashes on GetAt
CString woord;
char teken;
CString cletter;
int lengte = 0;
if((fscanf(stream, "%s", woord))!=EOF && status ==0)
{
lengte=woord.GetLength();
teken = woord.GetAt(lengte-1);
cletter.Format("%c",teken);
m_listbox.AddString(cletter);
}
i also tried woord[lengte -1 ], but same thing.
Here are my includes ( if needed)
#include "stdafx.h"
#include "FLA.h"
#include "FLADlg.h"
#include <afx.h>
#include "String.h"
#include <afxcoll.h>
The error msg says :
Debug assertion failed
File afx.inl
line 169
i took a look at that file and it tells me this :
_AFX_INLINE TCHAR CString::GetAt(int nIndex) const
{
ASSERT(nIndex >= 0);
ASSERT(nIndex < GetData()->nDataLength);
return m_pchData[nIndex];
}
Anyone any idea what the problem is and what to do about it ?