Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Question about OpenToRead in tier 1

Author
Message
Deion
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United States
Posted: 13th Sep 2011 06:29
i was looking at the example code for Files - ReadingFromFile.
it never seemed to work, so i commented out the write code and just used the OpenToRead however i get this error message

Failed to open file for reading

C:\Users\Deion\Documents\AGK\C_ProgrammingFiles(x86)_TheGameCreators_AGK_Projects_Basic_Examples_Files_ReadingFromFile_ReadingFromFileexe\media\myfile.txt at line 11


i looked here

C:\Users\Deion\Documents\AGK\C_ProgramFiles(x86)_TheGameCreators_AGK_Projects_Basic_Examples_Files_ReadingFromFile_ReadingFromFileexe\media\myfile.txt

does exist


this is using 1036 is it still wrong??? i completely removed 1028 when it came out and put 1036..


any ideas???

Cheers,
Deion G.
Deion
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United States
Posted: 13th Sep 2011 06:30
its looking at C_ProgrammingFiles(x86) but my folder is C_ProgramFiles(x86) to start out with.

Cheers,
Deion G.
Deion
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United States
Posted: 13th Sep 2011 07:19
the good news is it works good on the ipad and iphone, so for now its fine that the windows exe build isnt working right...

Cheers,
Deion G.
Dybing
12
Years of Service
User Offline
Joined: 12th Sep 2011
Location: Bergen, Norway
Posted: 13th Sep 2011 08:15
Hmmmm, must be something odd going on with your windows setup or AppGameKit installation, as I have no problems writing and reading files from windows builds of my current project (using v1036 of AGK).

As the filepaths do not match (programFiles vs programmingFiles), try saving the example project somewhere else. Just copy the entire folder, save it where you keep your own projects, and open from there. Then try again.

As it happens just a couple of hours ago, I implemented writing to and reading back data on a project I am working on. First time trying, and great success.

It's my first project using AppGameKit, and it is not a game but rather a small utility to help out with calculating various attributes relating to modular LED screens, and if using PC/Mac/iPad, also test the panels and screen by means of various test-patterns and panel identifiers.

My AppGameKit project folder is on a seperate partition (as I always keep OS/program installations and data files on different disks, a good practice for anyone who loves their data files )

File read/write from AppGameKit is pretty painless as far as I've experienced. The following snippet is how I have in my project saved out an array to a file, and reading it back. With a file-exist check for the first time running of the app that also initialize the array with empty (default) data.

Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 13th Sep 2011 08:18 Edited at: 13th Sep 2011 08:27
Post your entire code so we can see what's wrong. Offhand, you don't need to put the whole path in there. AppGameKit knows where to look for your files. So just "myfile.txt" would be enough to read the file.

EDIT: if you are just trying the example file, then it already has "myfile.txt" as the file path/name, and should work. If it's not working, then there is a problem somewhere. Maybe with permissions or something. The example project runs fine for me.

Deion
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United States
Posted: 13th Sep 2011 09:30
Yes it's the example code. Don't think it's a permission issue, the issue is it's looking for a folder that has programmingfiles , however mines programfiles ..

Cheers,
Deion G.
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 13th Sep 2011 09:41 Edited at: 13th Sep 2011 09:46
Oh, yes, I see what you mean. My write path is ...C_ProgramFiles... as well. Weird that yours is ProgrammingFiles instead.

What Windows are you using?

EDIT: I just thought of something... you said

Quote: "i completely removed 1028 when it came out and put 1036.."


Do you mean you deleted all the files? Or did you use the 1036 installer to un-install 1028. If you did not use the 1036 installer to un-install 1028, that might be the problem. It's not really obvious that the way to un-install 1028 is through the 1036 installer.

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 14th Sep 2011 20:17
Quote: "Do you mean you deleted all the files? Or did you use the 1036 installer to un-install 1028. If you did not use the 1036 installer to un-install 1028, that might be the problem. It's not really obvious that the way to un-install 1028 is through the 1036 installer"

I uninstalled 1028 and then installed 1036 and have no problems.
You dont nead to uninstall with the new installer from 1036.
Deion
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United States
Posted: 14th Sep 2011 20:19
i used the uninstaller list from windows to remove it. i just wanted to make sure no old artifacts of the previous were left behind.

using windows 7 professional 64bit

Cheers,
Deion G.
MMM
15
Years of Service
User Offline
Joined: 21st Jan 2009
Location: NSW, Australia
Posted: 18th Sep 2011 13:37 Edited at: 18th Sep 2011 14:31
I can confirm that this is a bug.


I'm running Win7 as an Administrator on Alienware m17x, all updated, no anitvirus software, no shared accounts, no network access (not while actually coding, that is), software v1036.


The code I'm running is almost identical to that posted above by Dybing - though I'm using standard arrays to store the data, not UDTs. The trouble with the above example is that, for Deion and I, the program crashes on the "OpenToRead" command with the standard "Failed to open file..." message. No reading of any kind is performed - so it's hard to tell if the writing process is working without ripping the files open manually.

That said, "OpenToWrite" apparently works. Example with 6 floats attached.

I thought the issue might be to do with my PC user-name containing spaces (eg; "blah blah") which it appears AppGameKit doesn't compute in some cases. Might that screw up the file path? Looking at Deion's posts, I imagine this is not the case. Plus, writing to files works.

I have tried the idea presented in this thread (eg, loading/saving/reading from different locations) and all have worked with one exception: installing...

I have uninstalled and reinstalled multiple times/ways now but I can't ever install the newest version of the AppGameKit software over the top of the previous version. Instead, I must uninstall the previous version and clean install v1036. The v1036 installation process does not work without the original installer (v1024?) being present (in the same folder)... Which makes the total instalation process take up almost 0.8G. Ouch. What's with that massive update size anyway?

Attachments

Login to view attachments
Bursar
15
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 18th Sep 2011 14:18
Quote: "I must uninstall the previous version and clean install v1036."

This was the recommended installation method by TGC anyway. The previous version should be uninstalled, and then the new version installed.

Quote: "The v1036 installation process does not work without the original installer (v1024?) being present "

Odd. I uninstalled the original version, deleted any left over files (mostly just the example projects) and then installed 1036 without any problem.

What happens if you try to install 1036 without the old version being present?
MMM
15
Years of Service
User Offline
Joined: 21st Jan 2009
Location: NSW, Australia
Posted: 18th Sep 2011 14:33 Edited at: 20th Sep 2011 15:11
An error message saying the original installer is missing.

Thought: could this be a corrupt donwload or something? Have been using the new version for a while - this is the only strange encounter I've had with it. Will try redownloading regardless.





EDIT: Yup. Corrupted download. So opentoread works without code changes. Oddly, the whole "requires original installer" thing still exists...

Bursar
15
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 18th Sep 2011 16:12
Quote: "could this be a corrupt donwload or something?"

Sounds like it could be. The 1036 version is a complete new version of AGK. It's not an upgrade or patch to the previous version.

Login to post a reply

Server time is: 2024-04-25 16:16:42
Your offset time is: 2024-04-25 16:16:42