PDA

View Full Version : importing variables from .txt


sandro
05-15-2007, 06:23 AM
hi,

I need to import variable values out of a txt file on a daily basis.
The file has a format similiar to this example:
20070315;1;-1;-1;+1;1.3299;0;1.3200;1.3300

Can I do that the Perl way? eg.

open(FILE, ... die "bla";
while (<INFILE>) {
@line = split();
$variable1 = $line[1]
...

I want to test if our trading system (www.aergo.ch (http://www.aergo.ch)) is tradeable through Ninjatarder.

Thanks for your help,

Sandro

NinjaTrader_Ray
05-15-2007, 06:59 AM
Hi Sandro,

You will need to use Microsoft .NET StreamReader and/or File classes. These classes deal with reading files. See the links below for help references. You can also google these classes should you need other sample code or help references.

http://msdn2.microsoft.com/en-us/library/system.io.streamreader.aspx

http://msdn2.microsoft.com/en-us/library/system.io.file.aspx