fastfileappend - newline character  [SOLVED]

Questions about MultiCharts and user contributed studies.
vking
Posts: 235
Joined: 21 May 2009
Has thanked: 51 times
Been thanked: 41 times

fastfileappend - newline character

Postby vking » 29 May 2012

If you have used fastfileappend function in the past - would you please confirm the equivalent code for this?

fileappend("c:\temp",numtostr(date,0)+newline);

fastfileappend("c:\temp",numtostr(date,0)+newline); -- Though there are no errors with this line(when replaced fileappend with fastfileappend) - it doesn't produce the same results as fileappend.

thanks

User avatar
TJ
Posts: 6523
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Re: fastfileappend - newline character

Postby TJ » 29 May 2012

vking wrote:If you have used fastfileappend function in the past - would you please confirm the equivalent code for this?

fileappend("c:\temp",numtostr(date,0)+newline);

fastfileappend("c:\temp",numtostr(date,0)+newline); -- Though there are no errors with this line(when replaced fileappend with fastfileappend) - it doesn't produce the same results as fileappend.

thanks

what results do you have?

what results you are expecting?

vking
Posts: 235
Joined: 21 May 2009
Has thanked: 51 times
Been thanked: 41 times

Re: fastfileappend - newline character

Postby vking » 29 May 2012

with fileappend -I get the new line character properly appended ( each new entry goes to the next line).

with fastfileappend + newline -> no text is being appended.

The following code with fileappend - works fine as expected.

Code: Select all

vars: filename("C:\test.txt");
Once begin
   if ADE.FileExists(filename)=false then begin
      FileAppend(filename,"DATE"+newline);
   end;
end;   
if date<>date[1] then begin
   FileAppend(filename,numtostr(DATE,0)+newline);
end;



The following code with fastfileappend - doesn't work as expected (only see header and nothing else).

Code: Select all

vars: filename("C:\test.txt");
Once begin
   if ADE.FileExists(filename)=false then begin
      FileAppend(filename,"DATE"+newline);
   end;
end;   
if date<>date[1] then begin
   FastFileAppend(filename,numtostr(DATE,0)+newline);
end;


output:
Code with fileappend:
C:\>del test.txt

C:\>type test.txt
DATE
1120528
1120529

Code with fastfileappend:
C:\>del test.txt

C:\>type test.txt
DATE

C:\>

When the second code with fastfileappend is executed again ( by turning off / turning on the indicator - this is the output - which matches the first one ) There is one time parse information is missing with fastfileappend.

C:\>type test.txt
DATE
1120528
1120529

User avatar
TJ
Posts: 6523
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Re: fastfileappend - newline character

Postby TJ » 29 May 2012

do you have the FastFileAppend.dll in your computer?

vking
Posts: 235
Joined: 21 May 2009
Has thanked: 51 times
Been thanked: 41 times

Re: fastfileappend - newline character

Postby vking » 29 May 2012

TJ wrote:do you have the FastFileAppend.dll in your computer?


Yes. I am also checking few more options for fastfileappend.dll - like flush mode etc to see if I can get the results same as fileappend.

Thanks

vking
Posts: 235
Joined: 21 May 2009
Has thanked: 51 times
Been thanked: 41 times

Re: fastfileappend - newline character  [SOLVED]

Postby vking » 29 May 2012

The following code takes care of the issue:

Code: Select all

vars: filename("C:\test.txt");

Once begin
   condition1=FastFileFlushMode(3);
   if ADE.FileExists(filename)=false then begin
      condition1=FastFileAppend(filename,"DATE"+newline);
      condition1=FastFileFlush(filename);
   end;
end;   
if date<>date[1] then begin
   condition1=FastFileAppend(filename,numtostr(DATE,0)+newline);
   condition1=FastFileFlush(filename);
end;


Return to “MultiCharts”