我不明白我程序中的第二个地址是什么`(readurl),我通过 cout'ing readurl(ifstream) 找到了它,谢谢你的帮助/声明!(来自 readurl 的地址与 cout'ing readurl 不同)
代码:
#include <fstream>
#include <iostream>
#include <string>
#include <tchar.h>
using namespace std;
int main()
{
string file; //filepath
int sel; //menu-switch
cout << "Select your Language!"<<endl;
cout << "1:German"<<endl;
cout << "2:English"<<endl;
cout << "Language: ";
cin >> sel;
getchar();
system("cls");
switch(sel)
{
case 2:
cout << "Hello!"<<endl;
cout << "Select your File: ";
cin >> file;
getchar();
system("cls");
break;
case 1:
cout << "Hallo!"<<endl;
cout << "Waehle deine Datei aus: ";
cin >> file;
getchar();
system("cls");
}
ifstream readurl(file.c_str());
char url[CHAR_MAX];
while(!readurl.getline(url,CHAR_MAX,'#'))
{
readurl.ignore();
}
cout << endl;
cout << &readurl<<endl<<readurl<<endl; // What is readurl?
cout << "File: (Sentences with # will be ignored)"<<endl;
cout << url;
getchar();
}
文本文件如下所示:
This will be readed
TEST
TEST
TEST
#This wont be readed
#This can be a comment.
#lsdjpofiuhpdsouhsdih+g