borodadada

_FileWriteToLine problem

4 posts in this topic

Hello, in my code, function _FileWriteToLine don't work. Example:

#include <FileConstants.au3>
#include <Date.au3>
#include <File.au3>

$time = 0
$start = 0
$path_file = "file.txt"
$file = 0

Func open_file($path, $mode)
   $file = FileOpen($path, $mode)
   If $file = -1 Then
       MsgBox(4096, "Not open.")
       Exit
    EndIf
EndFunc

Func write_date_to_file()
   Local $dateinseconds = _DateDiff('s', "1970/01/01 00:00:00", _NowCalc())
   _FileWriteToLine($file, 1, $dateinseconds, 0)
   ConsoleWrite ( @error & " write_date_to_file" & @CRLF)
EndFunc

Func close_file($file_)
   FileClose($file_)
EndFunc

Func get_time()
   $buff_time = FileReadLine($file, 1)
   ConsoleWrite ( $buff_time & " $buff_time" & @CRLF )
EndFunc

open_file($path_file, $FO_UTF8)
write_date_to_file()
close_file($file)

open_file($path_file, $FO_READ)
get_time()
close_file($file)

Whats problem? Alway error 2 = file dosent exist.

Share this post


Link to post
Share on other sites



Au3check says:

>Running AU3Check (3.3.14.2)  from:C:\Program Files\AutoIt3  input:C:\Users\Bert\AutoIt3.My\Temp\test.au3
"C:\Users\Bert\AutoIt3.My\Temp\test.au3"(13,27) : error: MsgBox() [built-in] called with wrong number of args.
        MsgBox(4096, "Not open.")
        ~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\Bert\AutoIt3.My\Temp\test.au3 - 1 error(s), 0 warning(s)
!>10:33:43 AU3Check ended. Press F4 to jump to next error.rc:2

after corrected, not open MsgBox appears. This is caused by your open mode, it must be $FO_UTF8+$FO_APPEND or $FO_UTF8+$FO_OVERWRITE.

Share this post


Link to post
Share on other sites

Had a similar problem. Thanks.

Share this post


Link to post
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