FileAppend function not creating file  [SOLVED]

Questions about MultiCharts and user contributed studies.
kagein
Posts: 55
Joined: 12 Oct 2017
Has thanked: 16 times
Been thanked: 10 times

FileAppend function not creating file

Postby kagein » 31 Jul 2019

Im using the code below to test the FileAppend function but nothing seems to happen. No file is created and if i manually create the file nothing is added to it.

Code: Select all

if close > open then begin

FileAppend("C:\Users\Administrator\Documents\text.txt", "HELLO WORLD");

end;

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: FileAppend function not creating file

Postby bowlesj3 » 31 Jul 2019

This works for me day in and day out. Of course you have to adjust "whatever" as appropriate.

Code: Select all

Variables:
LogPath(""),
LogFile(""),
;

if currentbar = 1 then
begin
LogFile = "A_VMy_Clone_Lines.txt";
LogPath = "C:\Users\Whatever\Downloads\" + LogFile;
FileAppend(LogPath,
"Here0 - Always check for hidden recalculate." +
" MaxBarsBack=" +
NumToStr(MaxBarsBack,0) +
NewLine);
end;

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: FileAppend function not creating file

Postby TJ » 31 Jul 2019

Im using the code below to test the FileAppend function but nothing seems to happen. No file is created and if i manually create the file nothing is added to it.
Make sure your MC has the Right to write to the directory.

kagein
Posts: 55
Joined: 12 Oct 2017
Has thanked: 16 times
Been thanked: 10 times

Re: FileAppend function not creating file  [SOLVED]

Postby kagein » 01 Aug 2019

This was the issue

WHM
Posts: 7
Joined: 28 May 2015
Location: Australia
Has thanked: 13 times

Re: FileAppend function not creating file

Postby WHM » 26 Oct 2021

What about a situation where FileAppend is working correctly, but periodically and unexpectedly results in a 'Can't open/create file' error?

Could this be Windows accessing the same directory at the same time and preventing MC access? Is there a way to stop this from happening (maybe via SYSTEM permissions)?


Return to “MultiCharts”