How to read / write a single line in a file

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

How to read / write a single line in a file

Postby arjfca » 11 Jul 2013

Hello

I'm looking to replace the Global Variable String that I'm using in Excel because it cause me some problem. To do so, I want to look at working with a file to trasmit info between MC and Excel

Anyone as an example of code use to write and read a single line to a file

Martin

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: How to read / write a single line in a file

Postby Henry MultiСharts » 25 Jul 2013

Hello Martin,

In power Language there is no prebuilt ability to read from a text file. This functionality can be accessed by means of a custom DLL.

youn56
Posts: 46
Joined: 29 Mar 2012
Has thanked: 13 times
Been thanked: 6 times

Re: How to read / write a single line in a file

Postby youn56 » 02 Aug 2013

Martin,

Have you tried "ELCollections.dll" ? I think it can do it.

Best regards.

Here is a sample of function i use :

Code: Select all

Var:
References(ListN.New),
derniereRef(0);
// Ouverture du fichier des references
Value1 = ListN.ReadFile(References,"C:\References.txt");
// Lecture de la derniere valeur
derniereRef = ListN.back(References);
value1=ListN.Clear(References);
// Affiche la derniere valeur
GenRef = derniereRef+1;
FileAppend("C:\References.txt",numtostr(derniereRef+1,0) + NewLine);


Return to “MultiCharts”