How to copy a certain number of chars from a file to a vector the STL-way?

前端 未结 5 816
不知归路
不知归路 2020-12-11 05:27

If I want to copy the contents of a file to a vector, I can do it like that:

std::ifstream file(\"path_to_file\");
std::vector buffer(std::istrea         


        
5条回答
  •  情歌与酒
    2020-12-11 06:08

    The "STL way" is to use copy_n, which is in the STL but not the C++ standard.

提交回复
热议问题