小编Dav*_*yan的帖子

如果我从不在打开的文件流上调用`close`会发生什么?

以下是相同案例的代码.

#include <iostream>
#include <fstream>

using namespace std;

int main () {
    ofstream myfile;
    myfile.open ("example.txt");
    myfile << "Writing this to a file.\n";
    //myfile.close();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

如果我取消注释该myfile.close()行,会有什么不同?

c++ file filestreams

20
推荐指数
3
解决办法
8854
查看次数

为什么std :: cout << main << std :: endl打印1?

#include <iostream>

int main(){
    std::cout << main << std::endl;
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

为什么在命令行中打印1?

c++

6
推荐指数
1
解决办法
663
查看次数

为什么它不会在我的代码中更改const对象?

这是代码

int main()
{   
  const int i = 2;
  const int * pi = &i;
  int* j = const_cast<int *> (pi);
  *j = 11;
  std::cout << *pi << std::endl;
  std::cout << i << std::endl;
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

结果:

11

2 <---为什么?

c++

3
推荐指数
1
解决办法
62
查看次数

如何在没有 X 服务器的情况下通过挤压运行 GUI 测试

我也有同样的疑问……如何在后台运行测试用例来测试 AUT,以便我可以在我的机器上处理其他一些任务。虽然在 squish 中的测试运行着如此多的弹出窗口,并且 AUT 功能不断出现在您的屏幕上,并且在您处理其他事情时很烦人。

squish

2
推荐指数
1
解决办法
1448
查看次数

标签 统计

c++ ×3

file ×1

filestreams ×1

squish ×1