Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. writing to txtfiles

writing to txtfiles

Scheduled Pinned Locked Moved C#
help
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rcwoods
    wrote on last edited by
    #1

    Hi I need some help I have a bit of code that i got from the tutorials on writing to text file. Problem is they used binary formatter.I dont want the text to be encrypted in binary.I want to see what has been written to txt. int id = int.Parse(textBox1.Text); string name = textBox2.Text; //create a new employee object Employee mp = new Employee(id, name); stream = File.Open("EmployeeInfo.txt",FileMode.Create,FileAccess.ReadWrite); BinaryFormatter bformatter = new BinaryFormatter(); bformatter.Serialize(stream, mp); stream.Close(); If someone could please help me out

    R G I S 4 Replies Last reply
    0
    • R rcwoods

      Hi I need some help I have a bit of code that i got from the tutorials on writing to text file. Problem is they used binary formatter.I dont want the text to be encrypted in binary.I want to see what has been written to txt. int id = int.Parse(textBox1.Text); string name = textBox2.Text; //create a new employee object Employee mp = new Employee(id, name); stream = File.Open("EmployeeInfo.txt",FileMode.Create,FileAccess.ReadWrite); BinaryFormatter bformatter = new BinaryFormatter(); bformatter.Serialize(stream, mp); stream.Close(); If someone could please help me out

      R Offline
      R Offline
      Robert Rohde
      wrote on last edited by
      #2

      Use the SoapFormatter[^] instead.

      1 Reply Last reply
      0
      • R rcwoods

        Hi I need some help I have a bit of code that i got from the tutorials on writing to text file. Problem is they used binary formatter.I dont want the text to be encrypted in binary.I want to see what has been written to txt. int id = int.Parse(textBox1.Text); string name = textBox2.Text; //create a new employee object Employee mp = new Employee(id, name); stream = File.Open("EmployeeInfo.txt",FileMode.Create,FileAccess.ReadWrite); BinaryFormatter bformatter = new BinaryFormatter(); bformatter.Serialize(stream, mp); stream.Close(); If someone could please help me out

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        I think that you are reading the wrong tutorial. That code is not writing a text file, it's serializing an object to a binary file. Use the File.CreateText method to create a text file. --- b { font-weight: normal; }

        1 Reply Last reply
        0
        • R rcwoods

          Hi I need some help I have a bit of code that i got from the tutorials on writing to text file. Problem is they used binary formatter.I dont want the text to be encrypted in binary.I want to see what has been written to txt. int id = int.Parse(textBox1.Text); string name = textBox2.Text; //create a new employee object Employee mp = new Employee(id, name); stream = File.Open("EmployeeInfo.txt",FileMode.Create,FileAccess.ReadWrite); BinaryFormatter bformatter = new BinaryFormatter(); bformatter.Serialize(stream, mp); stream.Close(); If someone could please help me out

          I Offline
          I Offline
          ideru
          wrote on last edited by
          #4

          if you are just writing to a normal txt file just use normal File create operations. string fname = "C:\\test.txt" using(StreamWriter sw = File.CreateText(fname)) { sw.WriteLine(data_to_be_written); }

          1 Reply Last reply
          0
          • R rcwoods

            Hi I need some help I have a bit of code that i got from the tutorials on writing to text file. Problem is they used binary formatter.I dont want the text to be encrypted in binary.I want to see what has been written to txt. int id = int.Parse(textBox1.Text); string name = textBox2.Text; //create a new employee object Employee mp = new Employee(id, name); stream = File.Open("EmployeeInfo.txt",FileMode.Create,FileAccess.ReadWrite); BinaryFormatter bformatter = new BinaryFormatter(); bformatter.Serialize(stream, mp); stream.Close(); If someone could please help me out

            S Offline
            S Offline
            SysJey
            wrote on last edited by
            #5

            StreamWriter sw = new StreamWriter(@"c:\filename.txt",false); sw.WriteLine((char)15); /// set char size while printing:laugh: sw.WriteLine("My name is: Jey"); sw.Close(); If u execute this code the text "My name is: Jey" inside the txt file. in "C Drive" and the file name "filename.txt" Jey

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups