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

Carl Schreiber
Moderator
12453
Carl Schreiber  
ankityadav:

Hi thanks but i don't understand this ??


This is to get a valid path to your user-folders without hard-coding the whole path: "c:\\...\\yourFolder\\".

This function is not imported in WinFile_v600! So you have to add this line between the two #imports:

        int  GetEnvironmentVariableW (string lpName, string& lpBuffer, int nSize);
qjol
3201
qjol  
gooly:

This is to get a valid path to your user-folders without hard-coding the whole path: "c:\\...\\yourFolder\\".

This function is not imported in WinFile_v600! So you have to add this line between the two #imports:



@ gooly i told you already it's wrong

you have to use SHGetFolderPath() and besides you use win7 and he use Winxp

ankityadav
208
ankityadav  
qjol:

@ gooly i told you already it's wrong

I m really confuse I don't know what is going on can you tell me what is the right way ??
ankityadav
208
ankityadav  
gooly:

This is to get a valid path to your user-folders without hard-coding the whole path: "c:\\...\\yourFolder\\".

This function is not imported in WinFile_v600! So you have to add this line between the two #imports:



Hi getting error don't know why ??

'OpenNewFileForWriting' - function not defined

'GetEnvironmentVariableW' - function not defined
ankityadav
208
ankityadav  
qjol:

@ gooly i told you already it's wrong

you have to use SHGetFolderPath() and besides you use win7 and he use Winxp


Can you please give me some sample of code so that i used it and see whether working or not ??for both reading and writing the file code???from different folder and also the file is csv ???
Carl Schreiber
Moderator
12453
Carl Schreiber  
ankityadav:

Hi getting error don't know why ??

'OpenNewFileForWriting' - function not defined

'GetEnvironmentVariableW' - function not defined


This function is not imported in WinFile_v600! So you have to add this line between: #import "kernel32.dll" ... #import:

        int  GetEnvironmentVariableW (string lpName, string& lpBuffer, int nSize);
ankityadav
208
ankityadav  
gooly:

This function is not imported in WinFile_v600! So you have to add this line between: #import "kernel32.dll" ... #import:


I have added but what about thiis error ??

OpenNewFileForWriting' - function not defined

Carl Schreiber
Moderator
12453
Carl Schreiber  
qjol:

@ gooly i told you already it's wrong

you have to use SHGetFolderPath() and besides you use win7 and he use Winxp

ok - xp may still be ANSI and not wide (CP_UTF8).

But GetEnvironmentVariableW will be more 'future-safe' especial if he will install Win 7 or 8 as xp is not supported anymore.

I myself won't like the idea reading/writing wide-char but the path-string is still ANSI?

Well ankityadav should try and print out the paths and use what ever works.

Gooly

ankityadav
208
ankityadav  
gooly:

ok - xp may still be ANSI and not wide (CP_UTF8).

But GetEnvironmentVariableW will be more 'future-safe' especial if he will install Win 7 or 8 as xp is not supported anymore.

I myself won't like the idea reading/writing wide-char but the path-string is still ANSI?

Well ankityadav should try and print out the paths and use what ever works.

Gooly


Hi but i m getting error

OpenNewFileForWriting' - function not defined

qjol
3201
qjol  
ankityadav:

Can you please give me some sample of code so that i used it and see whether working or not ??for both reading and writing the file code???from different folder and also the file is csv ???

You already have all the answers you need in this post
The question is do you just want someone to write for you the entire code