无人境地吧 关注:1贴子:23
  • 14回复贴,共1


1楼2017-07-12 06:29回复
    我其实真不想学啊,我已经得了厌学症,但是……就好好学习一次吧,我会加油把读取文件这个视频看完的


    2楼2017-07-12 06:34
    回复
      2025-05-29 14:06:50
      广告
      fstream 这个header用在于使用input、output data\ file string
      Just as an added note, there are still situations where it is necessary to explicitly close a file. Say you have a vector fileNames of files you need to process
      std::ifstream
      inFile;
      for( std::vector< std::string >::size_type i = 0; i < fileNames.size(); ++i )
      {
      inFile.clear(); i
      nFile.open( fileNames[ i ] );// code to process the fileinFile.close();}
      The reason you need to call close() at the end of the loop is that trying to open a new file without closing the first file will fail. The call to clear() at the beginning of the loop is necessary because closing a file and then opening another file does not clear the stream.


      3楼2017-07-12 07:02
      回复
        ifstream is a class 这里的i是指input
        ofstream 也是class, o是指output


        4楼2017-07-12 07:54
        回复
          由于 Mac 上没有 Home 和 End 键,于是在终端里打入了很长一段命令之后发现最前面有几个字母写错了,会很麻烦很麻烦。虽然 Command + 方向键不能在 Terminal 中使用,但是还是有办法可以跳到行头和行尾的。作为 Mac 中的 Terminal,BASH 有很多快捷键可以满足你的要求。下面就是一些 BASH 的快捷键。
          Ctrl + A 将光标跳到行头
          Ctrl + E 将光标跳到行尾
          Ctrl + L 清屏
          Ctrl + R 搜索以前执行过的命令
          Ctrl + C 终止正在运行的程序
          Ctrl + D 退出 Terminal(这里建议使用 Command + W 来完成)
          Ctrl + Z 将当前程序放置于背景,可以用 fg 来恢复


          5楼2017-07-12 07:54
          回复
            写的输入文件名打开文件 应该是这里出错了 inFile.fail()


            6楼2017-07-12 08:24
            收起回复
              做完作业有种爽快感,准备出去吃饭然后借电脑,继续在这边写完plan 和reflection


              7楼2017-07-12 09:02
              收起回复
                (x < 0) ? (y = 10) : (z = 20);表示 当(x < 0) 时, (y = 10)或者(z = 20)
                偷懒写法
                a = (x > 100) ? 0 :1;表示为
                if (x > 100)
                a = O;
                else
                a = 1 · '


                8楼2017-07-12 10:15
                回复
                  2025-05-29 14:00:50
                  广告
                  荒废了太多,惩罚,绝对的惩罚 !


                  9楼2017-07-13 07:12
                  回复
                    对自己已经愤怒到了极限


                    10楼2017-07-14 04:04
                    回复
                      不会写,不会写不会写
                      懒惰去死!


                      11楼2017-07-14 04:04
                      回复
                        好痛苦,已经过去三周了,物理不会写,好痛苦 !


                        12楼2017-07-17 11:17
                        回复