SIR I HAD WRITTEN AN CODE FOR FILE WRITE BUT IT IS NOT WORKING, i did not know the what is the problem in this code , PLEASE CORRECT THE CODE

 

DEAR SIR,


THIS IS MY CODE,

This code is not working


int start()


  {

fifteen_minutescall();


return (0);


}


int  fifteen_minutescall()

 {


 
 string fileName = "C:/abc.txt" ;
  
 
      int fileHandle = FileOpen(fileName,FILE_TXT|FILE_SHARE_READ|FILE_SHARE_WRITE);
 
      
      Alert("Added!");
      FileWrite(fileHandle,"this is for test only ");
      FileClose(fileHandle);
    
  
  
    
   return(0);



}

the above code is not working, I request you that please correct the above code, and provide me an solution.


please give me an simple example for reading an text for csv  file  ( with full example ) or give me an link with an example ( since i am dam new coder, guide me an example which will be easy to understand )



thank you sir

 
  1. DON'T SHOUT AT US. That is rude.
  2. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  3. string fileName = "C:/abc.txt" ;
    int fileHandle = FileOpen(fileName,FILE_TXT|FILE_SHARE_READ|FILE_SHARE_WRITE);
    Drop the "C:/" Files are only written to the sandbox (C:\Users\<USER>\AppData\Roaming\MetaQuotes\Terminal\<HEXSTRING>\MQL4\Files\abc.txt)
    Data Structure in MetaTrader 4 Build 600 and Higher - MQL4 Articles 17.02.2014
  4. You open the TXT file but don't state whether you are reading or writing it.
  5. Check your return codes Check your return codes and find out why. What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
  6. If you want a CSV file don't specify TXT
  7. If you had used this you would have found examples of append.
  8. If you had RTFM you would have found examples of write
Reason: