gpt4 book ai didi

C#防止CMD运行后自动关闭?

转载 作者:太空宇宙 更新时间:2023-11-03 17:32:20 25 4
gpt4 key购买 nike

<分区>

我想防止CMD在运行程序后自动关闭。

代码:

static void Main(string[] args)
{

FileStream textfsw = new FileStream("fileone.txt", FileMode.Append, FileAccess.Write); // CREATING FILE
StreamWriter textsw = new StreamWriter(textfsw);

Console.Write(" Enter your ID: ");
int ID = int.Parse(Console.ReadLine());
Console.Write(" Enter your Name: ");
string Name = Console.ReadLine();
Console.WriteLine(" Thank you! your logged in as" +Name+ +ID);

textsw.Close();
textfsw.Close();

FileStream textfs = new FileStream("fileone.txt", FileMode.Open, FileAccess.Read); // READING A FILE USING ReadAllLines
StreamReader textsr = new StreamReader(textfs);

String[] lines = File.ReadAllLines("fileone.txt");
}

截图: after running screenshot

我想在运行后显示以下内容并防止cmd关闭:

Thank you! your logged in as John Smith 12345

如有任何答案,我们将不胜感激。

谢谢。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com