I trying to write a char[256] to a text file. Below is my current work:
fstream ofs;
ofs.open("c:\\myURL.txt");
ofs.write((char*)testDest,256);
ofs.close();
It still does not work.
here is the error:
error C2440: 'type cast' : cannot convert from '' to 'char *'
update:
so far, here is my progress attempt, the code can compile, but when running, my program suddenly terminated.
ofstream stream;
CBar *a;
switch(uMessage) {
case WM_PAINT:
return bar->OnPaint();
case WM_ERASEBKGND:
return 1;
case WM_LBUTTONDOWN: //wira
if (!bar->OnClick(wParam, lParam)) {
stream.open("C:\\myURL.txt");
stream << a->testDest << endl; // if I replace `a->testDest` with "testword" string, my prgrom does not terminated. Why?
return 0;
}
break;