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

 
gooly:

Have looked at it? search for kernel32.

Hi can u help me to out of this ??
 
do you know how a csv-file looks like?
 
gooly:
do you know how a csv-file looks like?



A finishing blow question. Nice XD
 

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.

 

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.

 
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 ??
 
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 ??
 
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??
 
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);
 
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));

Reason: