How to Read and write data from out side the metatrader folder - page 2

ankityadav
208
ankityadav  
gooly:

Have looked at it? search for kernel32.

Hi can u help me to out of this ??
Carl Schreiber
Moderator
12453
Carl Schreiber  
do you know how a csv-file looks like?
Syed Naufal Gaddafi
2006
Syed Naufal Gaddafi  
gooly:
do you know how a csv-file looks like?



A finishing blow question. Nice XD
Carl Schreiber
Moderator
12453
Carl Schreiber  

So what is the problem?

You have the functions:

OpenNewFileForWriting(string FileName, bool ShareForReading = false)
WriteToFile(int FileHandle, string DataToWrite)
CloseFile(int FileHandle)

All you need beside this is the FileName (incl. the path!!) and the string to be written into the csv-file.

qjol
3201
qjol  

the difference between FileOpen and CreateFile is huge and besides:

Note This function FileOpen has limited capabilities and is not recommended. For new application development, use the CreateFile function.

ankityadav
208
ankityadav  
gooly:
do you know how a csv-file looks like?



I know hw it looks dear but the prblem is i m using fopen so it works only in mt4 folder thats why i put a question here to hw to remove this ??
ankityadav
208
ankityadav  
gooly:

So what is the problem?

You have the functions:

All you need beside this is the FileName (incl. the path!!) and the string to be written into the csv-file.



Is this work in every folder ??
ankityadav
208
ankityadav  
qjol:

the difference between FileOpen and CreateFile is huge and besides:

Note This function FileOpen has limited capabilities and is not recommended. For new application development, use the CreateFile function.


Thanks goil will this function work ??It is also work for csv as well if it can you show me some sample code for read and write the code in csv out side mt4??
Carl Schreiber
Moderator
12453
Carl Schreiber  
ankityadav:

Is this work in every folder ??

yes, example:

        string f = "12345678 1 2345678 2 2345678 3 2345678 4 2345678 5 2345678 6 2345678 7 2345678 8 2345678 9 23456789";
        GetEnvironmentVariableW("USERPROFILE", f, StringLen(f));
        fName = f + "\\Documents\\yourFolder\\" + fName;
        int fHandle = OpenNewFileForWriting(fName);
ankityadav
208
ankityadav  
gooly:

yes, example:



Hi thanks but i don't understand this ??

string f = "12345678 1 2345678 2 2345678 3 2345678 4 2345678 5 2345678 6 2345678 7 2345678 8 2345678 9 23456789";
        GetEnvironmentVariableW("USERPROFILE", f, StringLen(f));