Jump to content

_FileWriteToLine question


Pharo
 Share

Recommended Posts

I'm try to get a value ($line) to increase by 1 and then write over the old value. It will read the number correctly, add 1 to it correctly but won't write it.

CODE

$line = FileReadLine("items.txt",3)

$line=$line+1

_FileWriteToLine("items.txt", 3,($a), 0)

Link to comment
Share on other sites

Welcome to the forums.

$a isn't defined anywhere in your code.

If you check @error after the _FileWriteLine call, you'll see that the text is invalid. Apparently the function wants an actual string, not an integer. You can get around this by converting it.

Also, to replace the line (not insert), set the fourth parameter to 1.

Try this:

$line = FileReadLine("items.txt", 3)
        $line = $line + 1
        _FileWriteToLine("items.txt", 3, String($line), 1)

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

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...