Reading a Binary File into a bitset or vector

后端 未结 2 497
面向向阳花
面向向阳花 2021-01-19 14:38

How do I read a binary file into a bitset or vector? The binary file will vary in length. Is there a better container for this? I am ne

2条回答
  •  孤独总比滥情好
    2021-01-19 15:02

    If the file is large, Why should you read once, whole the file into the memory?

    You can read a little piece every time. The size is determined with the size in this func:

    file.read(buff, size)
    

    When the buff is char's array.

    I'm sorry, but You can't simplest read/save vector to file. for more details see here and here.

    And use Google, It's very helpful...

提交回复
热议问题