Jump to content


Photo

Game maker studio cannot open 2 files help!


  • Please log in to reply
2 replies to this topic

#1 _249138

_249138

    GMC Member

  • New Member
  • 10 posts
  • Version:GM:Studio

Posted 21 July 2012 - 06:05 PM

Help!!! i cannot open a file to read and a file to write in the same code why? (both files exit not the files are the problem)

file1=file_text_open_read("file1.txt");
file2=file_text_open_append("file2.txt");

............................................
//other codes
  • 0

#2 PrinceOthman

PrinceOthman

    GMC Member

  • GMC Member
  • 481 posts
  • Version:GM:Studio

Posted 21 July 2012 - 07:34 PM

file_text_open_read(fname) //Opens the file with the indicated name for reading. The function returns the id of the file that must be used in the other functions. You can open multiple files at the same time (32 max). Don't forget to close them once you are finished with them.

file_text_open_write(fname) //Opens the indicated file for writing, creating it if it does not exist. The function returns the id of the file that must be used in the other functions.

file_text_open_append(fname) //Opens the indicated file for appending data at the end, creating it if it does not exist. The function returns the id of the file that must be used in the other functions.
Read what the functions do in the help file so you can understand them better.

For you to read from file1.txt, and write to file2.txt, do this:
file1=file_text_open_read("file1.txt");
file2=file_text_open_write("file2.txt");

Edited by PrinceOthman, 21 July 2012 - 07:42 PM.

  • 0

#3 _249138

_249138

    GMC Member

  • New Member
  • 10 posts
  • Version:GM:Studio

Posted 21 July 2012 - 07:48 PM

yes but " file2=file_text_open_write() " will write at the beggining of the file and will erease the entire content of it , can't it be done somehow else?
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users