1. Save Bug
- Posted by Andy Jun 26, 2009
- 926 views
Hello,
I think this may be a bug. Whenever I goto write data to a file, my program crashes on me. Here is the code.
constant HP = 1 integer handle sequence file, fName fName = getSaveFileName(Main,file,FrostType) if length(fName) = 0 then return end if print(handle,HP) puts(handle,"\n") close(handle)
2. Re: Save Bug
- Posted by bernie Jun 26, 2009
- 960 views
Hello,
I think this may be a bug. Whenever I goto write data to a file, my program crashes on me. Here is the code.
constant HP = 1 integer handle sequence file, fName fName = getSaveFileName(Main,file,FrostType) if length(fName) = 0 then return end if print(handle,HP) puts(handle,"\n") close(handle)
I don't see where your getting a handle from ?
3. Re: Save Bug
- Posted by Andy Jun 26, 2009
- 1072 views
- Last edited Jun 27, 2009
Hello,
I think this may be a bug. Whenever I goto write data to a file, my program crashes on me. Here is the code.
constant HP = 1 integer handle, fn sequence file, fName fName = getSaveFileName(Main,file,FrostType) if length(fName) = 0 then return end if handle = open(fName,"wb") if handle = -1 then fn = message_box("Save Error", "Save File Error", MB_TASKMODAL) end if print(handle,HP) puts(handle,"\n") close(handle)
I don't see where your getting a handle from ?
Oh sorry. Anyways, I have corrected the code now. Can someone maybe see why there is a bug?
4. Re: Save Bug
- Posted by euphoric (admin) Jun 27, 2009
- 967 views
handle is probably -1... put a return in the "if handle =-1 then" block and see if that fixes it.
5. Re: Save Bug
- Posted by Andy Jun 27, 2009
- 874 views
handle is probably -1... put a return in the "if handle =-1 then" block and see if that fixes it.
No, that didn't fix it. It also happens when I try to load the data as well. Also, after the program crahses. The cursor in the editor goes back to fName position.
IE: | fName = getSaveFileName(MainWin,file,FrostType)
I think it may have to do with something in the fName variable, but I'm not sure why, as I have it declared correctley, for how I want to use it.
6. Re: Save Bug
- Posted by ChrisB (moderator) Jun 27, 2009
- 893 views
Hi
Where did it crash, and whats the crash message?
Chris
7. Re: Save Bug
- Posted by bernie Jun 27, 2009
- 994 views
Andy: I don't know what getSaveFileName function you are using but some libraries do not just return JUST the file name.
The filename sequence may contain additional information in the sequence so that you need to use a index to get the filename.
Print out the filename sequence and look at it.
8. Re: Save Bug
- Posted by Andy Jun 27, 2009
- 929 views
Andy: I don't know what getSaveFileName function you are using but some libraries do not just return JUST the file name.
The filename sequence may contain additional information in the sequence so that you need to use a index to get the filename.
Print out the filename sequence and look at it.
Ah, I have figured it out. the "file" variable needed to be like this.
file = ""
Now it works fine. Thanks
9. Re: Save Bug
- Posted by DerekParnell (admin) Jun 27, 2009
- 953 views
Ah, I have figured it out ...
That's great. However, next time you need some help with a problem like this, you should actually give us the error message(s) you got and maybe the relevant parts of any ex.err file created. Asking "what's wrong with this ..." is nearly always not enough information for us to go by.
Anyhow, glad you got it fixed.