Quote: "OK...It appears that I must read from one directory (media) and write to another (a system directory), "c:\users\owner\documents\.....etc."
"
You are laboring under a misconception. You do not need to write in one directory and read from another.
OpenToWrite() will always use the path returned by GetWritePath(), but you do not need to include the path in your OpenToRead() command.
Just use the file name in both cases. Both commands will look for the file in the media folder of your write path. If the file you are trying to open is not in the write path, AppGameKit will look for the file in its local media folder.
Notice that? It will look in both media folders, but the one in the write path takes precedence. If a file with the same name exists in both media folders, OpenToRead() will open the one in the write path.
So, really, just put the file name in there, and don't worry about the path. You MAY have sub-folders in the media folder if you wish.
This code illustrates how it works. Run the project and then look in the "test" sub-folder in the media folder of your write path. You will see the file there, it has been written there, and read from there, and it will not be in the project's media folder.
// write data to a file
OpenToWrite ( 1, "test\myfile.txt", 0 )
WriteLine(1, "THIS IS A TEST")
CloseFile ( 1 )
// reading from a file
OpenToRead ( 1, "test\myfile.txt" )
a$ = ReadLine ( 1 )
d$ = GetWritePath()
CloseFile ( 1 )
do
Print("String : " + a$)
Print("")
Print("Your write path is:")
` this part will crash on an iPad, because the
` write path is returned as a null string
f = 0
for e = 1 to len(d$)
if mid(d$, e, 1) = "\" OR mid(d$, e, 1) = "_"
print(mid(d$, f, e - f + 1) + chr(13))
f = e + 1
endif
next c
sync()
loop
EDIT: note that this will not work correctly if you broadcast to an iPad, as the GetWritePath() is still messed up with iOS. It will write and read the file, even in a sub-folder, but it doesn't return a valid string for GetWritePath(), so my code that displays the write path broken into small bits will crash on an iPad. I think this bug is getting fixed for the next update.