std::vector<char> vec; if (FILE *fp = fopen("filename", "r")) { char buf[1024]; while (size_t len = fread(buf, 1, sizeof(buf), fp)) { v.insert(vec.end(), buf, buf + len); } fclose(fp); }