小编luc*_*asn的帖子

从R文件导入内容

我正在研究R,我被要求使用在SimpleR库中提供的pi2000数据集(http://www.math.csi.cuny.edu/Statistics/R/simpleR/index.html/simpleR.R).然后我下载了这个文件.如何将其导入命令行?

r

7
推荐指数
2
解决办法
6296
查看次数

在Windows上编辑HOSTS文件

我正在编写一个管理主机文件条目的应用程序.所以我在C++中编写了一些代码来尝试访问和读取HOSTS文件:

#include <iostream>
#include <stdlib.h>
#include <fstream>

using namespace std;

int main(void)
{
    string line;
    fstream f ("C:\Windows\System32\drivers\etc\hosts");

    if ( f.is_open() )
    {
        while ( f.good() )
        {

            getline(f,line);
            cout << line << endl;
        }

        f.close();
    } else
        cout << "Error" << endl;

    system("pause");

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

在提出这个问题之前,我已经读过这个:编辑etc\hosts文件

所以,是的,我已经尝试以管理员身份运行该程序,但它仍然无效.我的程序如何读取/编辑以管理员身份运行的HOSTS?

c++ windows hosts

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

标签 统计

c++ ×1

hosts ×1

r ×1

windows ×1