Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Can';无法在Visual Studio Express中使用简单的ifstream 我正在学习C++,我正在学习。我遇到了麻烦,因为我的测试应用程序显然无法在VisualStudioExpress 2012中运行。这是我的密码: // ConsoleApp03.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <fstream> #include <string> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { ifstream file_reader; file_reader.open("C:\temp.txt"); // Test to see if the file was opened if (!file_reader.is_open() ) { cout << "Could not open file!" << endl; return 255; } string line; // Read the entire file and display it to the user; while (getline(file_reader,line)) { cout << line << endl; } // Close the file file_reader.close(); return 0; }_C++_Visual Studio 2012_Ifstream - Fatal编程技术网

Can';无法在Visual Studio Express中使用简单的ifstream 我正在学习C++,我正在学习。我遇到了麻烦,因为我的测试应用程序显然无法在VisualStudioExpress 2012中运行。这是我的密码: // ConsoleApp03.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <fstream> #include <string> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { ifstream file_reader; file_reader.open("C:\temp.txt"); // Test to see if the file was opened if (!file_reader.is_open() ) { cout << "Could not open file!" << endl; return 255; } string line; // Read the entire file and display it to the user; while (getline(file_reader,line)) { cout << line << endl; } // Close the file file_reader.close(); return 0; }

Can';无法在Visual Studio Express中使用简单的ifstream 我正在学习C++,我正在学习。我遇到了麻烦,因为我的测试应用程序显然无法在VisualStudioExpress 2012中运行。这是我的密码: // ConsoleApp03.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <fstream> #include <string> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { ifstream file_reader; file_reader.open("C:\temp.txt"); // Test to see if the file was opened if (!file_reader.is_open() ) { cout << "Could not open file!" << endl; return 255; } string line; // Read the entire file and display it to the user; while (getline(file_reader,line)) { cout << line << endl; } // Close the file file_reader.close(); return 0; },c++,visual-studio-2012,ifstream,C++,Visual Studio 2012,Ifstream,这可能会也可能不会解决您的问题,但是\后跟char是一个转义序列。所以你的文件路径实际上是无效的。试一试 file_reader.open("C:\\temp.txt"); \t实际上是指选项卡。请参阅。这可能会解决问题,也可能不会解决问题,但是\后跟char是一个转义序列。所以你的文件路径实际上是无效的。试一试 file_reader.open("C:\\temp.txt"); \t实际上是指选项卡。请参阅。这可能会解决问题,也可能不会解决问题,但是\后跟char是一个转义序列。所以你的文

这可能会也可能不会解决您的问题,但是
\
后跟char是一个转义序列。所以你的文件路径实际上是无效的。试一试

file_reader.open("C:\\temp.txt");

\t
实际上是指选项卡。请参阅。

这可能会解决问题,也可能不会解决问题,但是
\
后跟char是一个转义序列。所以你的文件路径实际上是无效的。试一试

file_reader.open("C:\\temp.txt");

\t
实际上是指选项卡。请参阅。

这可能会解决问题,也可能不会解决问题,但是
\
后跟char是一个转义序列。所以你的文件路径实际上是无效的。试一试

file_reader.open("C:\\temp.txt");

\t
实际上是指选项卡。请参阅。

这可能会解决问题,也可能不会解决问题,但是
\
后跟char是一个转义序列。所以你的文件路径实际上是无效的。试一试

file_reader.open("C:\\temp.txt");

\t
实际上是指选项卡。请参阅。

尝试
文件读取器。打开(“C:\\temp.txt”)
文件读取器打开(“C:/temp.txt”)使用双反斜杠有效。这是一种转义,不是吗?因为它通常用于指示特殊字符,例如
'\n'
,要在字符串文本中指定反斜杠字符本身,您需要使用
'\\'
。请尝试
文件读取器。打开(“C:\\temp.txt”)
文件读取器打开(“C:/temp.txt”)使用双反斜杠有效。这是一种转义,不是吗?因为它通常用于指示特殊字符,例如
'\n'
,要在字符串文本中指定反斜杠字符本身,您需要使用
'\\'
。请尝试
文件读取器。打开(“C:\\temp.txt”)
文件读取器打开(“C:/temp.txt”)使用双反斜杠有效。这是一种转义,不是吗?因为它通常用于指示特殊字符,例如
'\n'
,要在字符串文本中指定反斜杠字符本身,您需要使用
'\\'
。请尝试
文件读取器。打开(“C:\\temp.txt”)
文件读取器打开(“C:/temp.txt”)使用双反斜杠有效。这是一种转义,不是吗?因为它通常用于指示特殊字符,例如
'\n'
,要在字符串文本中指定反斜杠字符本身,需要使用
'\\'