
Originally Posted by
ADSOFT
GCDEF,
No it doesn't work. did you try to compile it, or is this something you made up?
What does your compilier tell you?
My compiler told me your first two worked, but the second two it couldn't convert a CString* to a CString. When I removed the &, it compiled cleanly. You may want to dump the attitude. Sheesh. This compiled cleanly.
Code:
#include "stdafx.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
struct print
{
int x; //row
int y; //col
int fid;
CString data;
char *format;
};
// The one and only application object
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
CString temp("Address");
print form [] =
{
{ 30, 40, 1,CString("Name"), "N/A" },
{ 30, 42, 1, temp , "N/A" },
{ 30, 44, 1, temp, "N/A" },
{ 30, 50, 1, temp, "N/A" },
};
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
_tprintf(_T("Fatal Error: MFC initialization failed\n"));
nRetCode = 1;
}
else
{
// TODO: code your application's behavior here.
}
return nRetCode;
}