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. Visual Basic
  4. Writing the content of a text file

Writing the content of a text file

Scheduled Pinned Locked Moved Visual Basic
tutorialhelpquestion
7 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.
  • H Offline
    H Offline
    hvgyufg28fh38tyr78hf
    wrote on last edited by
    #1

    hi all, i want to write the content of a text file to another txt file exactly like what i have in original file. i used write,writeline and put functions. but to my surprise, i found the text file is benig written without the new line character. for example: original file content: aefaiojefioae fafajfpfjafaffjaeiofjafjfjfi faijfoijf faioj Para 2: fafaopfopfkaokfopfaopkfopkopafopkfpoaf. fijaoijij fafijoifjfiajparwto MY COPIED FILE content: aefaiojefioae fafajfpfjafaffjaeiofjafjfjfi faijfoij ffaioj Para 2: afaopfopfkaokfopfaopkfopkopafopkfpoaf. ijaoijij fafijoifjfiajparwto Can anyone help me on how to write the content of the file exactly as what i have in original? Thanks, mahi.

    L A realJSOPR P 4 Replies Last reply
    0
    • H hvgyufg28fh38tyr78hf

      hi all, i want to write the content of a text file to another txt file exactly like what i have in original file. i used write,writeline and put functions. but to my surprise, i found the text file is benig written without the new line character. for example: original file content: aefaiojefioae fafajfpfjafaffjaeiofjafjfjfi faijfoijf faioj Para 2: fafaopfopfkaokfopfaopkfopkopafopkfpoaf. fijaoijij fafijoifjfiajparwto MY COPIED FILE content: aefaiojefioae fafajfpfjafaffjaeiofjafjfjfi faijfoij ffaioj Para 2: afaopfopfkaokfopfaopkfopkopafopkfpoaf. ijaoijij fafijoifjfiajparwto Can anyone help me on how to write the content of the file exactly as what i have in original? Thanks, mahi.

      A Offline
      A Offline
      Ashfield
      wrote on last edited by
      #2

      Why not just use system.io.file.copy?

      Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

      1 Reply Last reply
      0
      • H hvgyufg28fh38tyr78hf

        hi all, i want to write the content of a text file to another txt file exactly like what i have in original file. i used write,writeline and put functions. but to my surprise, i found the text file is benig written without the new line character. for example: original file content: aefaiojefioae fafajfpfjafaffjaeiofjafjfjfi faijfoijf faioj Para 2: fafaopfopfkaokfopfaopkfopkopafopkfpoaf. fijaoijij fafijoifjfiajparwto MY COPIED FILE content: aefaiojefioae fafajfpfjafaffjaeiofjafjfjfi faijfoij ffaioj Para 2: afaopfopfkaokfopfaopkfopkopafopkfpoaf. ijaoijij fafijoifjfiajparwto Can anyone help me on how to write the content of the file exactly as what i have in original? Thanks, mahi.

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        File.Copy is the simple way. Copying bytes, not characters (hence using a byte array), is the alternative. :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


        I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


        1 Reply Last reply
        0
        • H hvgyufg28fh38tyr78hf

          hi all, i want to write the content of a text file to another txt file exactly like what i have in original file. i used write,writeline and put functions. but to my surprise, i found the text file is benig written without the new line character. for example: original file content: aefaiojefioae fafajfpfjafaffjaeiofjafjfjfi faijfoijf faioj Para 2: fafaopfopfkaokfopfaopkfopkopafopkfpoaf. fijaoijij fafijoifjfiajparwto MY COPIED FILE content: aefaiojefioae fafajfpfjafaffjaeiofjafjfjfi faijfoij ffaioj Para 2: afaopfopfkaokfopfaopkfopkopafopkfpoaf. ijaoijij fafijoifjfiajparwto Can anyone help me on how to write the content of the file exactly as what i have in original? Thanks, mahi.

          realJSOPR Offline
          realJSOPR Offline
          realJSOP
          wrote on last edited by
          #4

          Is the text in memory, or is it still in the original file?

          .45 ACP - because shooting twice is just silly
          -----
          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
          -----
          "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

          H 1 Reply Last reply
          0
          • realJSOPR realJSOP

            Is the text in memory, or is it still in the original file?

            .45 ACP - because shooting twice is just silly
            -----
            "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
            -----
            "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

            H Offline
            H Offline
            hvgyufg28fh38tyr78hf
            wrote on last edited by
            #5

            text is not in memory ..its in original text file only.

            realJSOPR 1 Reply Last reply
            0
            • H hvgyufg28fh38tyr78hf

              text is not in memory ..its in original text file only.

              realJSOPR Offline
              realJSOPR Offline
              realJSOP
              wrote on last edited by
              #6

              Then do what everyone else said, and just use File.Copy

              .45 ACP - because shooting twice is just silly
              -----
              "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
              -----
              "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

              1 Reply Last reply
              0
              • H hvgyufg28fh38tyr78hf

                hi all, i want to write the content of a text file to another txt file exactly like what i have in original file. i used write,writeline and put functions. but to my surprise, i found the text file is benig written without the new line character. for example: original file content: aefaiojefioae fafajfpfjafaffjaeiofjafjfjfi faijfoijf faioj Para 2: fafaopfopfkaokfopfaopkfopkopafopkfpoaf. fijaoijij fafijoifjfiajparwto MY COPIED FILE content: aefaiojefioae fafajfpfjafaffjaeiofjafjfjfi faijfoij ffaioj Para 2: afaopfopfkaokfopfaopkfopkopafopkfpoaf. ijaoijij fafijoifjfiajparwto Can anyone help me on how to write the content of the file exactly as what i have in original? Thanks, mahi.

                P Offline
                P Offline
                plecco
                wrote on last edited by
                #7

                I agree. I think File.Copy would be your best solutions if you want your text file to be exactly the same as the original.

                Plecco Technologies, Inc. Web Design | Software Development | Internet Marketing

                modified on Wednesday, January 27, 2010 10:02 AM

                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