Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on May 6th, 2012  |  syntax: None  |  size: 0.45 KB  |  views: 24  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Lua: Prevent carriage return in binary code
  2. file=io.open(filepath,'rb')
  3. file:seek("set")
  4. file:seek("cur",startoffset)
  5. filecontent=file:read(endoffset-startoffset)
  6. io.output(test.tmp)
  7. io.write(filecontent)
  8.        
  9. local file = assert(io.open(filepath, "rb"), "Could not open file for reading.")
  10. local filecontent = file:read("*a")
  11. file:close()
  12. file = assert(io.open("temp.tmp", "wb"),  "Could not open file for writing.")
  13. file:write(filecontent)
  14. file:close()