Read strange File

 

Hi all,

Hi have this kind of file to read


Var1 Var2 Var3 Var4 Var5 Var6
Date1 Hour1
Date2 Hour2
Date3 Hour3
Var1 Var2 Var3 Var4 Var5 Var6
Date1 Hour1
Date2 Hour2
Date3 Hour3
Var1 Var2 Var3 Var4 Var5 Var6
Date1 Hour1
Date2 Hour2
Date3 Hour3
Var1 Var2 Var3 Var4 Var5 Var6
Date1 Hour1
Date2 Hour2
Date3 Hour3
Var1 Var2 Var3 Var4 Var5 Var6
Date1 Hour1
Date2 Hour2
Date3 Hour3


As you see, variables i need, been on 4 lines.

how i can count the lines i'm reading and say to program that it's reading other data type?

Do i explain myself? sorry my bad english

 

depends on field delimiter in a way and most vip is actual data format - u not show that: eg, is Date a 32bit int? or is it ascii? and if so what ascii chs used? same i think info needed for all datums you list. if not 100% sure about total data/file format - the method is not easy to recommend... ;)

u can use CSV type fileread functions or BINARY type fileread functions.

just all depends on actual format of each and every field and possible field delimiters etc.

eg, FileReadArray() could pick off Var1,..,Var6 - just all depends on actual format of file content

and... some trial and error testing with the reads and using Print() to see wat got... (well that wat i'd do to be total confident got read down a-ok :)

 

This is my file...


what it is >>>> string string string string int

what it is >>>>date time

Pippo Buy Gold -60 +/- 1.00 400
01/11/2008 15.18 GMT
02/11/2008 15.15 GMT
03/11/2008 15.12 GMT


I'm using "TAB" char to separate data. 'couse my file is writed by external software, than i can' use ";" to separate.

my file is an simple .txt

 

confused.com here... ;)

"Var1 Var2 Var3 Var4 Var5 Var6" does not look like "string string string string int"

tell u wat - is possible u can attach example/actual file to your next post - a file with exact contents u need reading, is possible?

.

have u looked at MetaEditor Help?

MQL4 Reference - File functions

this would show u wat can and cannot be done

.

thankyou

 

He He, yes i read help, and tryin' to use array too...but it go in loop and need to kill it! I write code, but i'm not professional.

I can't post the esactly file 'couse it have personal information, not mine but of other people. I'm sorry it would be help us.

But i try again to explain my problem.and put a fake of info's file again.



Simple, i can't use normal readfile 'couse it have not index of lines it read, so i can't control the cycle of data that born and die in 4 lines.


I need to draw a triangle, the triangle have the 3 data point as reference time. and Pippo, Buy, Gold is an simple information text.

Pippo Buy Gold -60 +/- 1.00 400
01/11/2008 15.18 GMT
02/11/2008 15.15 GMT
03/11/2008 15.12 GMT


how i can run this code?SORRY AGAIN MY BAD ENGLISH :-)

 

i fixed the plan, i'm rewriting all datas into file by hand and patience, now they stored on just one line so i can use simple readfile LoL

thanks anyway

 

well, u have come to a solution that works for u and that is good ;)

Reason: