Jump to content

Why not able to write into file?


oemript
 Share

Recommended Posts

Referring to following coding, I would like to know on why not able to add content into file.

Does anyone have any suggestions?
Thanks in advance for any suggestions

 

#include <Array.au3>
#include <File.au3>
_FileTest()

Func _FileTest()
   Local $sFilePath = "D:\stocks.txt"
   Local $hFileOpen = FileOpen($sFilePath, $FO_OVERWRITE)
   Local $string = ""
   Local $string1 = "Start 1"
   Local $string2 = "Start 2"
   $string = $string1
   _ArrayConcatenate($string, $string2, 1)
   _FileWriteFromArray($sFilePath, $string, 1)
   FileClose($hFileOpen)
   Sleep(1000)
   Local $hFileOpen = FileOpen($sFilePath, $FO_APPEND )
   $string1 = "Append 1"
   $string2 = "Append 2"
   $string = $string1
   _ArrayConcatenate($string, $string2, 1)
   _FileWriteFromArray($sFilePath, $string, 1)
   FileClose($hFileOpen)
   Sleep(1000)
   ShellExecute($sFilePath)
EndFunc

 

Link to comment
Share on other sites

@oemript

As I was saying just yesterday, doing some error checking will help you debug your code.

Don't start a new thread for each question you have, when you can find most of the answers in the Help file.

By the way, if you did read the Help file more carefully about _ArrayConcatenate() function, you could see that you have to pass two arrays to the function, instead of two strings as you did.

So, please, read the Help file carefully, and add error checking to your script.

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...