Alazam Posted February 14, 2015 Posted February 14, 2015 Hello i want to add some information to a file without delete it what i can add to my filewrite or fileopen for it ? i know that in c++ its app but i dont know in lua
Anubhav Posted February 14, 2015 Posted February 14, 2015 Just a example open = fileOpen(yourarguments) local read = fileRead( open ) fileWrite( open, read.."yolo" ) See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
Alazam Posted February 14, 2015 Author Posted February 14, 2015 local positionfile = fileOpen("position.txt", false) fileWrite(positionfile, "Position: x = " .. x .. " y = " .. y .. " z = " .. z .. " ") fileClose(positionfile) here is my code it work but i want it to write at the end of the existing file
Dealman Posted February 14, 2015 Posted February 14, 2015 Use the MTA Wiki. If you go to Client Functions, you'll find all the available file functions there, including fileIsEOF. If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
Alazam Posted February 14, 2015 Author Posted February 14, 2015 Thank i have check the wiki but havent read this line When you open a file, its file position is set to the beginning of the file. Each call to fileRead or fileWrite moves the position ahead by the amount of bytes that were read/written. This way, by using fileIsEOF you can check if you've passed through the whole file.
Alazam Posted February 14, 2015 Author Posted February 14, 2015 And i have another question it work fine but it dont return to ligne how i can do it ?
Dealman Posted February 14, 2015 Posted February 14, 2015 Do you mean to add a new line? Put "\r\n" in your string to add linebreaks. If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
ixjf Posted February 14, 2015 Posted February 14, 2015 Jesus. fileGetSize fileSetPos I used to know how to code, but then I took an arrow in the knee. Project Redivivus - Remaking Old School MTA With New Code MTA 0.6 Nightly 1 released
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now