add to file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • monkw
    New Member
    • Feb 2008
    • 2

    add to file

    hi
    how to add some informations to file?
    i tryed like this:
    Code:
    if (!open (FILE, ">some_file.txt"))
    {
    	die "cant open file"
    }
    print FILE "hello world";
    but it overwriting informations no adding.
    how to solve that?
  • diegososa
    New Member
    • Oct 2007
    • 19

    #2
    I think you post in the wrong section... that isn't Python, right?

    Comment

    • KaezarRex
      New Member
      • Sep 2007
      • 52

      #3
      Originally posted by monkw
      hi
      how to add some informations to file?
      i tryed like this:
      Code:
      if (!open (FILE, ">some_file.txt"))
      {
      	die "cant open file"
      }
      print FILE "hello world";
      but it overwriting informations no adding.
      how to solve that?
      I don't know what language you are using, but in Python, this is how you append to a file:
      [CODE=python]output = open("some_file .txt", "a")
      output.write("h ello world\n")
      output.close()[/CODE]

      Comment

      Working...