• <small id='EJoSo'></small><noframes id='EJoSo'>

        <tfoot id='EJoSo'></tfoot>
      1. <i id='EJoSo'><tr id='EJoSo'><dt id='EJoSo'><q id='EJoSo'><span id='EJoSo'><b id='EJoSo'><form id='EJoSo'><ins id='EJoSo'></ins><ul id='EJoSo'></ul><sub id='EJoSo'></sub></form><legend id='EJoSo'></legend><bdo id='EJoSo'><pre id='EJoSo'><center id='EJoSo'></center></pre></bdo></b><th id='EJoSo'></th></span></q></dt></tr></i><div id='EJoSo'><tfoot id='EJoSo'></tfoot><dl id='EJoSo'><fieldset id='EJoSo'></fieldset></dl></div>
        <legend id='EJoSo'><style id='EJoSo'><dir id='EJoSo'><q id='EJoSo'></q></dir></style></legend>
          <bdo id='EJoSo'></bdo><ul id='EJoSo'></ul>

      2. 从 std::cin 读取二进制数据

        时间:2024-08-14
        • <small id='ydsKH'></small><noframes id='ydsKH'>

          <i id='ydsKH'><tr id='ydsKH'><dt id='ydsKH'><q id='ydsKH'><span id='ydsKH'><b id='ydsKH'><form id='ydsKH'><ins id='ydsKH'></ins><ul id='ydsKH'></ul><sub id='ydsKH'></sub></form><legend id='ydsKH'></legend><bdo id='ydsKH'><pre id='ydsKH'><center id='ydsKH'></center></pre></bdo></b><th id='ydsKH'></th></span></q></dt></tr></i><div id='ydsKH'><tfoot id='ydsKH'></tfoot><dl id='ydsKH'><fieldset id='ydsKH'></fieldset></dl></div>
            <tbody id='ydsKH'></tbody>
            <legend id='ydsKH'><style id='ydsKH'><dir id='ydsKH'><q id='ydsKH'></q></dir></style></legend>

              <tfoot id='ydsKH'></tfoot>
                  <bdo id='ydsKH'></bdo><ul id='ydsKH'></ul>

                  本文介绍了从 std::cin 读取二进制数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  std::cin 读取二进制(非格式化)数据到 stringstringstream 的最简单方法是什么??

                  What is the easiest way to read binary (non-formated) data from std::cin into either a string or a stringstream?

                  推荐答案

                  std::cin 未使用 ios_binary 打开.如果你必须使用cin,那么你需要重新打开它,这不是标准的一部分.

                  std::cin is not opened with ios_binary. If you must use cin, then you need to reopen it, which isn't part of the standard.

                  这里有一些想法:http://compgroups.net/comp.unix.programmer/How-can-I-reopen-std-cin-and-std-cout-in-binary-mode.

                  一旦它是二进制的,你就可以使用 cin.read() 来读取字节.如果您知道在您的系统中,文本和二进制之间没有区别(并且您不需要可移植),那么您可以放心地使用 read.

                  Once it's binary, you can use cin.read() to read bytes. If you know that in your system, there is no difference between text and binary (and you don't need to be portable), then you can just use read without worrying.

                  这篇关于从 std::cin 读取二进制数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:更改流上的下一项的 C++ 自定义流操纵器 下一篇:为什么 ostream_iterator 不能按预期工作?

                  相关文章

                  <small id='fwN6x'></small><noframes id='fwN6x'>

                • <tfoot id='fwN6x'></tfoot>

                    <i id='fwN6x'><tr id='fwN6x'><dt id='fwN6x'><q id='fwN6x'><span id='fwN6x'><b id='fwN6x'><form id='fwN6x'><ins id='fwN6x'></ins><ul id='fwN6x'></ul><sub id='fwN6x'></sub></form><legend id='fwN6x'></legend><bdo id='fwN6x'><pre id='fwN6x'><center id='fwN6x'></center></pre></bdo></b><th id='fwN6x'></th></span></q></dt></tr></i><div id='fwN6x'><tfoot id='fwN6x'></tfoot><dl id='fwN6x'><fieldset id='fwN6x'></fieldset></dl></div>
                    <legend id='fwN6x'><style id='fwN6x'><dir id='fwN6x'><q id='fwN6x'></q></dir></style></legend>
                      • <bdo id='fwN6x'></bdo><ul id='fwN6x'></ul>