Reading / Writing a text file?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • GlesgaMick

    Reading / Writing a text file?

    Ok, it must be one of the most fundamentally useful things in a programming
    language, to be able to read and write files.

    I want to know how i can do this in Javascript. I want to open a text
    file, use it to fill some variables on a webpage. And have that webpage
    save any changes.

    Is there a single command like the C fopen("filename ", "ra");?

  • David Dorward

    #2
    Re: Reading / Writing a text file?

    GlesgaMick wrote:
    [color=blue]
    > I want to know how i can do this in Javascript. I want to open a text
    > file, use it to fill some variables on a webpage. And have that webpage
    > save any changes.[/color]



    --
    David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is

    Comment

    • Randy Webb

      #3
      Re: Reading / Writing a text file?

      GlesgaMick wrote:
      [color=blue]
      > Ok, it must be one of the most fundamentally useful things in a programming
      > language, to be able to read and write files.[/color]

      Depends on the programming language and its environment.
      [color=blue]
      > I want to know how i can do this in Javascript. I want to open a text
      > file, use it to fill some variables on a webpage. And have that webpage
      > save any changes.[/color]

      If its running on your local computer, yes, under certain limitations.
      If its a Windows based IE, you can use the FileSystemObjec t to read
      files from the local drive and then save them, with security permission
      given.

      If you want to read/write files on a server, you can read them with an
      HTTPRequestObje ct but JS has no ability to write files on a server, you
      have to do that on the server.
      [color=blue]
      > Is there a single command like the C fopen("filename ", "ra");?[/color]

      Depends on where the files are. Whether they are on the users computer
      or on the server. The FileSystemObjec t ActiveX in MSIE on a PC can do
      that. Search MSDN.

      --
      Randy
      comp.lang.javas cript FAQ - http://jibbering.com/faq
      Answer:It destroys the order of the conversation
      Question: Why?
      Answer: Top-Posting.
      Question: Whats the most annoying thing on Usenet?

      Comment

      • Andrew Thompson

        #4
        Re: Reading / Writing a text file?

        On Sun, 24 Oct 2004 09:41:21 -0400, GlesgaMick wrote:

        Given David and Randy have already contributed sensible answers..
        [color=blue]
        > Is there a single command like the C fopen("filename ", "ra");?[/color]

        You mean like..

        <wild-ass psuedo-code>
        IE.fopen("virus .exe", "e")?
        </wild-ass psuedo-code>

        Comment

        • GlesgaMick

          #5
          Re: Reading / Writing a text file?

          ok, thanks for the help guys, and no, i don't intend to create a virus,
          its a uni project i'm working on, a rather annoying project, i won't bore
          you with the specific details...

          Comment

          Working...