I'm new to WIN32 programming. I followed up a tutorial series and tried to include it to my code. I got the error FILE was not declared in this scope. Seeing this in the video it seems that it is a type. But it isn't recognised here.
void write_file(char *path) {
FILE *file;
file = fopen(path,"wb");
int _size = GetWindowTextLength(TextBox);
char *data = new char [_size+1];
GetWindowText(TextBox,data,_size+1);
fwrite(data,_size+1,file);
}
void save_file(HWND hwnd) {
OPENFILENAME ofn;
char file_name[100];
ZeroMemory(&ofn,sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hwnd;
ofn.lpstrFile = file_name;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = 100;
ofn.lpstrFilter = "All Files\0*.*";
ofn.nFilterIndex = 1;
GetSaveFileName(&ofn);
write_file(ofn.lpstrFile);
}
#include <cstdio>(or#include <stdio.h>if you are using C and not C++)FILE(from<cstdio>) is an old C library feature. Since you tagged C++,std::fstream(from<fstream>) might be better for you