1 2 3 4 5 6 7 8 9 10 11
char * sendfile = "C:\\STOL.jpg"; FILE *fin; fin = fopen(sendfile, "rb"); long size; fseek(fin, 0, SEEK_END); size = ftell(fin); fseek(fin, 0, SEEK_SET); char * buf=(char *)malloc(size); fread(buf,size,100500,fin); fclose(fin); cout << buf;
1 2 3 4
cc1plus: warnings being treated as errors Line 1: warning: deprecated conversion from string constant to 'char*'' Line 3: error: expected constructor, destructor, or type conversion before '=' token compilation terminated due to -Wfatal-errors.