streamwriter

    1热度

    1回答

    我是Android编程的新手,为我的毕业论文编写我的第一个应用程序。 现在我几乎完成了,但还剩一件事,我无法在网上的任何地方得到答案。所以也许这里有人可以帮忙。 我的应用程序必须做的一部分是将以前操作的结果写入可自由访问的文件以供日后分析。 所以我走到这一步,是我能够写一个文件到SD卡用下面的代码: String packageName = this.getClass().getPackage()

    0热度

    2回答

    是否有某种方法可以在不创建新对象的情况下重新打开Streamwriter以写入?因为此刻,当WriteOdd被调用时,StreamWriter的是覆盖WriteEven,这之前它被称为:/ public void WriteEven() { StreamWriter writer = new StreamWriter(FILENAME); for (int

    4热度

    8回答

    我试图读取C#中的文本文件并将行号添加到行中。 这是我的输入文件: This is line one this is line two this is line three ,这应该是输出: 1 This is line one 2 this is line two 3 this is line three 这是我到目前为止的代码: class Pr

    1热度

    3回答

    我的第一个问题就在,如果我声明我FILESTREAM等以这种方式 filestream file; streamreader file_in; streamwriter file_out; try { file = new filestream("data.txt", FileMode.OpenOrCreate); file_in = new streamreader

    2热度

    2回答

    这里是我的测试写入文件: [Test] public void CanWriteManifestToFile() { byte[] data = new byte[] { 0x00, 0x01, 0x80, 0x1f }; MemoryStream ms = new MemoryStream(data); var mg = new Manif

    2热度

    1回答

    如何确保我正在写的消息位于空行并且不会写入更多文本?它涉及到首先阅读文件吗?这是我的代码到目前为止。 Console.WriteLine("What do you wish to write?"); String input2 = Console.ReadLine(); Console.WriteLine("What file do you wish to write to?"); fpat

    128热度

    10回答

    我想将行附加到我的文件。我使用一个StreamWriter: StreamWriter file2 = new StreamWriter(@"c:\file.txt"); file2.WriteLine(someString); file2.Close(); 我的文件的输出应低于对方几个字符串,但我只有一排,这是覆盖每次运行该代码的时间。 有什么方法让StreamWriter追加到现有的文

    0热度

    4回答

    我保存在一个列表文件的末尾每行一个文件... 但是我希望做的是检查,如果该文件已经包含了行,以便它不保存同一条线两次。 因此,使用StreamWriter写入文件之前,我想检查每个项目列表中,看它是否在文件中存在。如果是这样,我想在使用StreamWriter之前从列表中删除它。 .....除非有更好的方法去做这件事吗?

    4热度

    4回答

    我正在接管一个C#项目,当测试它时,我收到错误。错误在于日志文件无法写入,因为它正在被另一个进程使用。下面的代码: public void WriteToLog(string msg) { if (!_LogExists) { this.VerifyOrCreateLogFile(); // Creates log file if it does n

    1热度

    1回答

    我在使用C#编写程序时遇到问题。 我想从ListBox1中到文本文件,这是从ListBox2项目命名的保存字符串变量,喜欢这里: Write = new StreamWriter(xxxxx); for (int I = 0; I < ListBox1.Items.Count; I++) { Text = (SubCategories.Items[I]).ToString();