- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
请帮忙,我有下面的小片段代码来测试 fsteam,但它总是失败,我的 strace 文件跟在代码后面。它适用于 unix 但不适用于 linux。感谢您的帮助。
#include <fstream.h>
#include <iostream.h>
using namespace std;
int main () {
fstream filestr;
filestr.open ("test.txt",ios::out | ios::in | ios::app );
if(filestr.bad())
{
cout << "Bad input." << endl;
}
if(filestr.fail())
{
cout << "Open failed." << endl;
}
filestr << " dsgesvsvds";
filestr.close();
return 0;
}
execve("./a.out", ["./a.out"], [/* 83 vars */]) = 0
brk(0) = 0x10754000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b8cf1e9d000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b8cf1e9e000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("tls/x86_64/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("tls/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("x86_64/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/products/oracle/11.2.0/client/lib/tls/x86_64/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/products/oracle/11.2.0/client/lib/tls/x86_64", 0x7fffd262c040) = -1 ENOENT (No such file or directory)
open("/products/oracle/11.2.0/client/lib/tls/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/products/oracle/11.2.0/client/lib/tls", 0x7fffd262c040) = -1 ENOENT (No such file or directory)
open("/products/oracle/11.2.0/client/lib/x86_64/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/products/oracle/11.2.0/client/lib/x86_64", 0x7fffd262c040) = -1 ENOENT (No such file or directory)
open("/products/oracle/11.2.0/client/lib/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/products/oracle/11.2.0/client/lib", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/roscodev/rosco/bin/tls/x86_64/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/roscodev/rosco/bin/tls/x86_64", 0x7fffd262c040) = -1 ENOENT (No such file or directory)
open("/roscodev/rosco/bin/tls/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/roscodev/rosco/bin/tls", 0x7fffd262c040) = -1 ENOENT (No such file or directory)
open("/roscodev/rosco/bin/x86_64/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/roscodev/rosco/bin/x86_64", 0x7fffd262c040) = -1 ENOENT (No such file or directory)
open("/roscodev/rosco/bin/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/roscodev/rosco/bin", {st_mode=S_IFDIR|0775, st_size=12288, ...}) = 0
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=80518, ...}) = 0
mmap(NULL, 80518, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2b8cf1e9f000
close(3) = 0
open("/usr/lib64/libstdc++.so.6", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\364\304\3528\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=976312, ...}) = 0
mmap(0x38eac00000, 3145600, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x38eac00000
mprotect(0x38eace6000, 2093056, PROT_NONE) = 0
mmap(0x38eaee5000, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xe5000) = 0x38eaee5000
mmap(0x38eaeee000, 73600, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x38eaeee000
close(3) = 0
open("tls/x86_64/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("tls/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("x86_64/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/products/oracle/11.2.0/client/lib/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/roscodev/rosco/bin/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib64/libm.so.6", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`>\200\3438\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=615136, ...}) = 0
mmap(0x38e3800000, 2629848, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x38e3800000
mprotect(0x38e3882000, 2093056, PROT_NONE) = 0
mmap(0x38e3a81000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x81000) = 0x38e3a81000
close(3) = 0
open("tls/x86_64/libgcc_s.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("tls/libgcc_s.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("x86_64/libgcc_s.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("libgcc_s.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/products/oracle/11.2.0/client/lib/libgcc_s.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/roscodev/rosco/bin/libgcc_s.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib64/libgcc_s.so.1", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\36\200\3468\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=58400, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b8cf1eb3000
mmap(0x38e6800000, 2151784, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x38e6800000
mprotect(0x38e680d000, 2097152, PROT_NONE) = 0
mmap(0x38e6a0d000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xd000) = 0x38e6a0d000
close(3) = 0
open("tls/x86_64/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("x86_64/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/products/oracle/11.2.0/client/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/roscodev/rosco/bin/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib64/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220\332\1\3438\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1722304, ...}) = 0
mmap(0x38e3000000, 3502424, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x38e3000000
mprotect(0x38e314e000, 2097152, PROT_NONE) = 0
mmap(0x38e334e000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14e000) = 0x38e334e000
mmap(0x38e3353000, 16728, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x38e3353000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b8cf1eb4000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b8cf1eb5000
arch_prctl(ARCH_SET_FS, 0x2b8cf1eb4bf0) = 0
mprotect(0x38e334e000, 16384, PROT_READ) = 0
mprotect(0x38e3a81000, 4096, PROT_READ) = 0
mprotect(0x38eaee5000, 24576, PROT_READ) = 0
mprotect(0x38e2e1b000, 4096, PROT_READ) = 0
munmap(0x2b8cf1e9f000, 80518) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b8cf1e9f000
write(1, "Open failed.\n", 13Open failed.
) = 13
exit_group(0) = ?
最佳答案
#include <fstream.h>
#include <iostream.h>
应该是
#include <fstream>
#include <iostream>
关于c++ - 我的 fstream 总是失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5265788/
我不明白 int 63823 为何比 double 1.0 占用更少的空间。在这个特定实例中,int 中是否没有存储更多信息? 最佳答案 I don't understand how an int 6
这可能不是一个直接的代码问题,但它是一个经常出现在 SO 上的问题,我发现阅读它非常有用。 App Store - Help answering “Missing Compliance” (using
我在我们的应用程序中使用 syncfusion 寻呼机和下拉列表请打开以下链接。 https://stackblitz.com/edit/angular-nv6myv?file=src%2Fapp%2
以便解释指针和引用in this question我写了这段代码。 MyClass& MyClass::MyInstance() { static MyClass & myLoca
在 C 和 C++ 中,assert 是一个非常 重量级例程,将错误写入 stdout 并终止程序。在我们的应用程序中,我们实现了一个更强大的 assert 替代品,并为其提供了自己的宏。已尽一切努力
我已经创建了一个 MVC webApi 项目,现在我想使用身份验证和授权。我想我已经实现了这种安全措施,但由于某种原因,有些事情变糟了,当我编写我的凭据并尝试调用一些 webApi 方法时,显示消息“
我发现自己使用一种奇怪的方式向我的函数添加回调函数,我想知道是否有更通用的方式向函数添加回调函数,最好的情况是我的所有函数都检查最后给定的作为函数的参数,如果是,则将其用作回调。 我以前是这样的: v
几乎从来没有我只想获取某个 Remote 的情况;我总是想要所有的 Remote 。我认为这将是一个足够常见的用例,git 会考虑它(与他们有 pull.rebase true 的方式相同)。 那么,
我正在尝试使用 inarray 但它总是返回 true?有任何想法吗? (所有 li 均已显示) $("#select-by-color-list li").hide(); // get the se
我正在尝试为我公司的开发环境设置过期网址。我们使用 lighttpd在此环境中提供上传的文件,我发现 these docs这似乎相当有希望。 问题是我似乎根本无法让它工作,而且我有点不知所措,试图找出
我无法让“文件夹”外部变量工作。我总是得到[:]。 我正在 Windows 下的 Grails 上进行开发(这就是为什么外部配置文件看起来像 file:C:\path\to/file)。 我在另一个项
这个问题是出于对 PL 如何工作的好奇,而不是其他任何事情。 (它实际上是在查看与 Haskell 不同的 SML 时想到的,因为前者使用按值调用 - 但我的问题是关于 Haskell。) Haske
我有一个高速缓存内存模块,我希望它是可字寻址的,但有字节的写使能信号。 always @ (posedge clk) begin //stuff... if(write) begin
我正在处理一些代码,其中一个对象“foo”正在创建另一个对象对象“bar”,并向其传递一个Callable。之后 foo 将返回bar,然后我希望 foo 变得无法访问(即:可用于垃圾收集)。 我最初
我已将我的程序与此方法相关联: public static void CreateFileAssociation(string extension, string key, string descri
所以我正在进行目录遍历,但我无法让 opendir 按照我想要的方式工作。它总是无法打开我发送的目录,它给出了一些未知的错误。我通常传入 argv[1],但我放弃了,只是开始硬编码路径。 char *
这个问题在这里已经有了答案: How do I compare strings in Java? (23 个回答) 关闭 9 年前。 出于某种原因,我的(基本)程序总是打印我为 else 语句保留的
我不想冒为此提出破解的风险,因为它涉及 datetime 对象。基本上,我想按如下方式进行转换: 2010-04-21 06:37:53 -> 2010-04-21 06:40:00 2010-08-
我正在用 C 语言玩文件 I/O。我正在尝试使用 fgets 从一个文件中读取数据并将其输出到另一个文件。问题是它总是返回 NULL,因此没有任何内容被复制到输出文件中。这是我的代码: #includ
class MyClass { // empty class with no base class }; int main() { MyClass* myClass = new MyC
我是一名优秀的程序员,十分优秀!