read file with stream in C++

I want read file with stream, I use follow function :

std::vector<FileStruct> ReadFileStreaming(CString filePath, int startOffset)
std::vector<FileStruct> wholeFile;
std::ifstream stream;;
char buffer[STREAM_BUFFER];
if (stream.is_open())
    while (!stream.eof())
        FileStruct fileStream;
        fileStream.startOffset = stream.tellg();
        stream >> buffer;, buffer + strlen(buffer));
        fileStream.endOffset = stream.tellg();
  return wholeFile;

and FileStruct is :

struct FileStream
 int startOffset;
 std::vector<byte> data;
 int endOffset;

my buffer is : STREAM_BUFFER = 1500;

this function for big file is not correct....

and when I changed buffer size, it does not change

what is wrong? can help me?

1 answer

  • answered 2018-01-14 11:22 Butuzov

    I am just aspiring C++ programmer but isn't assign can be used as, buffer); here? Sizefor 1st argument and value for 2nd?