小编Mat*_*teo的帖子

C#在桌面上保存txt文件

如何保存我在桌面上创建的txt文件?

这是代码:

void CreaTxtBtnClick(object sender, EventArgs e){
    string filePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
    filePath = filePath + @"\Error Log\";
    TextWriter sw = new StreamWriter(@"Gara.txt");

    int rowcount = dataGridView1.Rows.Count;
    for(int i = 0; i < rowcount - 1; i++){
        sw.WriteLine(
            dataGridView1.Rows[i].Cells[0].Value.ToString() + '\t' +
            dataGridView1.Rows[i].Cells[1].Value.ToString() + '\t' +
            dataGridView1.Rows[i].Cells[2].Value.ToString() + '\t' +
            dataGridView1.Rows[i].Cells[3].Value.ToString() + '\t' +
            dataGridView1.Rows[i].Cells[4].Value.ToString() + '\t' +
            dataGridView1.Rows[i].Cells[5].Value.ToString() + '\t' +
            dataGridView1.Rows[i].Cells[6].Value.ToString() + '\t' +
            dataGridView1.Rows[i].Cells[7].Value.ToString() + '\t'
        );
    }
    sw.Close();
    MessageBox.Show("File txt creato correttamente");
}
Run Code Online (Sandbox Code Playgroud)

我按照这些指示思考

Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
filePath = …
Run Code Online (Sandbox Code Playgroud)

.net c# desktop file

6
推荐指数
2
解决办法
5594
查看次数

查找包含非打印字符(空字节)的文件

我的应用程序日志中包含一个包含奇怪字符的字段。仅当我使用命令时我才能看到这些字符less

我尝试将代码行的结果复制到文本文件中,我看到的是

CTP_OUT=^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
Run Code Online (Sandbox Code Playgroud)

我想知道是否有办法找到这些空字符。我尝试过使用grep命令,但没有显示任何内容

unix linux bash grep

6
推荐指数
2
解决办法
8679
查看次数

标签 统计

.net ×1

bash ×1

c# ×1

desktop ×1

file ×1

grep ×1

linux ×1

unix ×1