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. Help on Writing Image Information(Location/Descriptions) to a txtfile

Help on Writing Image Information(Location/Descriptions) to a txtfile

Scheduled Pinned Locked Moved C#
questionsysadminhelp
5 Posts 2 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.
  • T Offline
    T Offline
    Thomas Toh
    wrote on last edited by
    #1

    // Save the stream to disk System.IO.FileStream newFile = new System.IO.FileStream(Server.MapPath(sSavePath + sFilename), System.IO.FileMode.Create); newFile.Write(myData, 0, myData.Length); newFile.Close(); TextWriter tw = new StreamWriter("d://fyp//images//saved images//info.txt"); // write a line of text to the file tw.WriteLine("txtFName.txt*txtLName*IDTextBox*" + sSavePath + sFilename); // close the stream tw.Close(); on the TextWriter tw = new StreamWriter("d://fyp//images//saved images//info.txt"); how do i specify the directory so that it will save to /images on my project folder? without specifying the exact location? also on the tw.WriteLine("txtFName.txt*txtLName*IDTextBox*" + sSavePath + sFilename); the result on the notepad is that it writes exactly the same text to the notepad... how do i make it so that i'll save whatever I input onto my textboxes?

    C T 2 Replies Last reply
    0
    • T Thomas Toh

      // Save the stream to disk System.IO.FileStream newFile = new System.IO.FileStream(Server.MapPath(sSavePath + sFilename), System.IO.FileMode.Create); newFile.Write(myData, 0, myData.Length); newFile.Close(); TextWriter tw = new StreamWriter("d://fyp//images//saved images//info.txt"); // write a line of text to the file tw.WriteLine("txtFName.txt*txtLName*IDTextBox*" + sSavePath + sFilename); // close the stream tw.Close(); on the TextWriter tw = new StreamWriter("d://fyp//images//saved images//info.txt"); how do i specify the directory so that it will save to /images on my project folder? without specifying the exact location? also on the tw.WriteLine("txtFName.txt*txtLName*IDTextBox*" + sSavePath + sFilename); the result on the notepad is that it writes exactly the same text to the notepad... how do i make it so that i'll save whatever I input onto my textboxes?

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Thomas Toh wrote:

      how do i specify the directory so that it will save to /images on my project folder? without specifying the exact location?

      The same as you do for the stream, server.mappath.

      Thomas Toh wrote:

      how do i make it so that i'll save whatever I input onto my textboxes?

      By removing the quotes. txtFName.Text + " " + txtLName.Text + " " + IDTextBox.Text

      Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      T 1 Reply Last reply
      0
      • C Christian Graus

        Thomas Toh wrote:

        how do i specify the directory so that it will save to /images on my project folder? without specifying the exact location?

        The same as you do for the stream, server.mappath.

        Thomas Toh wrote:

        how do i make it so that i'll save whatever I input onto my textboxes?

        By removing the quotes. txtFName.Text + " " + txtLName.Text + " " + IDTextBox.Text

        Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        T Offline
        T Offline
        Thomas Toh
        wrote on last edited by
        #3

        thanks.. the second one works.. however.. for the first one... is this the correct code? TextWriter tw = new StreamWriter("Server.MapPath/images/info.txt"); also.. if i write 2 or more image files... it will overwrite the exisiting one... how do i make it so that it will write onto next line in my textfile

        modified on Thursday, May 1, 2008 9:52 AM

        C 1 Reply Last reply
        0
        • T Thomas Toh

          thanks.. the second one works.. however.. for the first one... is this the correct code? TextWriter tw = new StreamWriter("Server.MapPath/images/info.txt"); also.. if i write 2 or more image files... it will overwrite the exisiting one... how do i make it so that it will write onto next line in my textfile

          modified on Thursday, May 1, 2008 9:52 AM

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Wow. OK, what have we learned ? When a string is in quotes, it becomes a literal string, NOT code. Try copying the code you use above, and it will work.

          Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

          1 Reply Last reply
          0
          • T Thomas Toh

            // Save the stream to disk System.IO.FileStream newFile = new System.IO.FileStream(Server.MapPath(sSavePath + sFilename), System.IO.FileMode.Create); newFile.Write(myData, 0, myData.Length); newFile.Close(); TextWriter tw = new StreamWriter("d://fyp//images//saved images//info.txt"); // write a line of text to the file tw.WriteLine("txtFName.txt*txtLName*IDTextBox*" + sSavePath + sFilename); // close the stream tw.Close(); on the TextWriter tw = new StreamWriter("d://fyp//images//saved images//info.txt"); how do i specify the directory so that it will save to /images on my project folder? without specifying the exact location? also on the tw.WriteLine("txtFName.txt*txtLName*IDTextBox*" + sSavePath + sFilename); the result on the notepad is that it writes exactly the same text to the notepad... how do i make it so that i'll save whatever I input onto my textboxes?

            T Offline
            T Offline
            Thomas Toh
            wrote on last edited by
            #5

            ok thanks... also.. if i write 2 or more image files... it will overwrite the exisiting one... how do i make it so that it will write onto next line in my textfile

            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