Announcement

Collapse
No announcement yet.

File() function

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

  • File() function

    I want to open a file on a web site instead of my local disk. The following syntax does not appear to work although it's not throwing any sort of error either:

    var f = new File("http://www.myweb.com/file.txt");

    Any ideas?
    Standing on the shoulders of giants.

  • #2
    I've done a bit more investigation and it appears that I can't get the File() function to work on my local drive either.

    I check the status of the f.open() command and it returns true which indicates that it has found the file and opened it.

    I then check the status of the f.eof() command and that also returns true which is confusing me...? The file has data and I haven't started reading it yet...
    Standing on the shoulders of giants.

    Comment


    • #3
      Okay I'm talking to myself here:

      I found the HTTP() function and I can open and read the file from the web.

      I still haven't been able to resolve why the File() funciton doesn't work though but I'm going to ignore that because I don't need it right now...
      Standing on the shoulders of giants.

      Comment


      • #4
        wildfiction,

        I cannot tell you why it is not working for you as you did not post the steps you are taking, but here is an excerpt of code that works in one of my efs's that I use every day. Please note the eof check is performed only after the file has been opened.

        PHP Code:
        daily_stats = new File("TRADEFILES/"+sSymbol+"/"+Strat_Names[x]+"/utility data files/Daily Stats "+Strat_Names[x]+dateb()+".txt");
        daily_stats.open("at+");
        var    
        counter 0;
        var 
        _stats = new Array();
        while(!
        daily_stats.eof()) {
            
        _stats[counter++] = daily_stats.readln(); 
        }
                
        daily_stats.close(); 
        here is a link that has some other instructional code I posted where Jason had also provided a link to some references for file access.

        Based on this info, I am sure you will be able to figure out where you are having problems.

        Comment


        • #5
          I believe you will find that the file() function, for security reasons, will only write to the formulaoutput folder under your eSignal install directory.

          G
          Garth

          Comment


          • #6
            Thanks for the input guys. I'll have a look at this over the week. Much appreciated.
            Standing on the shoulders of giants.

            Comment

            Working...
            X