txt文件可以用ifstream 打开么

如题所述

完全可以的。
参考代码:
#include<iostream>

#include<fstream>

using namespace std;

int main()

{

ifstream fin("hello.txt");

while (fin!=NULL)

{

int a;

char str[10];

fin>>a;

fin>>str;

cout<<a<<"+char"<<str<<endl;

}

}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2014-12-30
面是一个基本的主机访问规则示例:
vsftpd : .example.com
这条规则指示TCP Wrappers监测在example.com域内的任何主机向FTP守护进程(vsftpd)发出的连接.如果这条规则出现在hosts.allow 中,连接则被接受.如果这条规则出现在hosts.deny中,连接则被拒绝.
下面的主机访问规则比较复杂,而且使用两个选项领域:
sshd : .example.com \ :spawn /bin/echo `/bin/date` access denied>>/var/log/sshd.log \ :deny
相似回答