Print File Function

Questions about MultiCharts and user contributed studies.
benysl
Posts: 13
Joined: 06 Jun 2006

Print File Function

Postby benysl » 08 Jun 2006

Hi

does anybody know if I can do this with the print file function

print(file("c:\test.txt"),"testing 123");

do something

print(file("c:\test.txt"),"testing 456");

do something

print(file("c:\test.txt"),"testing 789");


Basically this will out a test.txt. I do not want the line to be appended.
testing123
testing456
testing789


what I want is basically 1 line for each function that it have perform without appending the file.

I try to use a filedelete function but it doesnt work as the file is being open so it cannot be deleted.

Any advise is much appreciated.

Thank you

User avatar
Alex Kramer
Posts: 834
Joined: 23 Feb 2006

Postby Alex Kramer » 09 Jun 2006

You might want to consider the FileAppend function.

I'm pasting here the description of that reserved word:

FileAppend

Sends information to the indicated existing ASCII file and adds the information to the bottom of the file.

FileAppend("str_Filename", "str_Text") ;

With str_Filename - an alphanumeric string indicating the path and file name for the existing ASCII text file in quotes and str_Text is the string expression to be appended to the bottom of the file.

If the indicated file does not exist, it will be created. Before numeric expressions can be sent for adding, they must be converted to string format using the NumToStr function.

Example

To send date to an ASCII file in case the symbol has a 10% or more gap down on the open,:

If Open < High[1] * 1.1 Then
FileAppend("c:\GapDown.txt", "Symbol gapped down on " + NumToStr(Date, 0) +
NewLine);

Guest

Postby Guest » 10 Jun 2006

Alex Kramer wrote:You might want to consider the FileAppend function.

I'm pasting here the description of that reserved word:

FileAppend

Sends information to the indicated existing ASCII file and adds the information to the bottom of the file.

FileAppend("str_Filename", "str_Text") ;

With str_Filename - an alphanumeric string indicating the path and file name for the existing ASCII text file in quotes and str_Text is the string expression to be appended to the bottom of the file.

If the indicated file does not exist, it will be created. Before numeric expressions can be sent for adding, they must be converted to string format using the NumToStr function.

Example

To send date to an ASCII file in case the symbol has a 10% or more gap down on the open,:

If Open < High[1] * 1.1 Then
FileAppend("c:\GapDown.txt", "Symbol gapped down on " + NumToStr(Date, 0) +
NewLine);


hi Alex,

thanks for the information as I am using some robot to execute the signal based on the text file and it only understand the first line of information. Instead of appending to the bottom of the text, is there a way to insert the text to the first line??

thank you


Return to “MultiCharts”