IonicWind Software

IWBasic => General Questions => Topic started by: chris on August 10, 2008, 07:55:20 PM

Title: opening files on vista
Post by: chris on August 10, 2008, 07:55:20 PM
where on vista can you read from files? this is the code I’m using . $MAIN
$INCLUDE "downlodeFile.inc"
DEF File1: FILE
DEF HashCode1: STRING
OPENCONSOLE
IF DownloadToFile("www.authorskeep.com","hosted/chris_fallen/Comicalitys_Shack.txt","C:\\\\Users\\chris\\hashFile20.txt",NULL)
PRINT "Works Like a charm"
IF OPENFILE (File1,"C:\\Users\\chris\\hashFile20.txt","R")
PRINT "file opended"
IF READ File1,HashCode1
PRINT "Hash code read"
ENDIF
CLOSEFILE File1
ELSE
PRINT "file can not be opned"
ENDIF
ELSE
PRINT "can not get file"
ENDIF
PRINT HashCode1
DO : UNTIL INKEY$<>""
CLOSECONSOLE
I’m sure there’s nothing wrong with it the only problem is that it’s not opening the file I’m guessing this is just another thing that make me wonder why I like vista. Any ideas on how I can make this work?

thanks in advance
chris
Title: Re: opening files on vista
Post by: Ionic Wind Support Team on August 10, 2008, 08:14:45 PM
Chris,
Why the four slashes?

"C:\\\\Users\\chris\\hashFile20.txt"

Title: Re: opening files on vista
Post by: chris on August 10, 2008, 08:20:25 PM
i don't really know when someone was helping me getting it to work that what they had and i never messed with it. The function works that was the first thing i looked at the file is right where it's meant to be
Title: Re: opening files on vista
Post by: Ionic Wind Support Team on August 10, 2008, 08:33:07 PM
Chris,
Remove two of the slashes for a start.

As for Vista....   I have it here for testing but run as an administrator and never had problems opening and reading files.  Of course I have UAC turned off as well.

Perhaps there are "read" restrictions in effect for that directory.  I gave up a while ago trying to figure out Vistas group policy editor, and created an admin account will all attributes enabled.  That was after Vista refused to copy a file for me from my D: drive to the C: drive.

Try saving into a different directory, such as the public documents on Vista, less restrictions that way.  Or perhaps Vista needs more time to close/flush file buffers than previous OS's.  Insert a sleep(1) between the download and the attempt to open to see if that makes a difference.

Other than that?  See if it works properly for you in XP.

Paul.

Title: Re: opening files on vista
Post by: chris on August 10, 2008, 08:51:30 PM
thanks for the help i'll keep trying differnt things so far it dosen't matter what directory i save it in none of them work i'll keep trying tho

yours chris
Title: Re: opening files on vista
Post by: Ionic Wind Support Team on August 10, 2008, 10:30:02 PM
Chris,
Sorry.  My fault.  OpenFile returns 0 on success.

IF OPENFILE (File1,"C:\\Users\\chris\\hashFile20.txt","R") = 0
...
ENDIF

Paul.
Title: Re: opening files on vista
Post by: chris on August 11, 2008, 03:51:29 PM
you know i must of read that 20 times in the help files and never thought twice about it. one qusetion tho why is openfile differnt then the rest? i'm just wondering anyway thanks for the help i got it to work now

thanks
chris
Title: Re: opening files on vista
Post by: Ionic Wind Support Team on August 11, 2008, 04:10:22 PM
It is common in other languages to have 0 mean "no errors" and <> 0 mean an error occurred.  I keep it that way for backwards compatibility with my earlier languages now if for no other reason.

Glad it works for you,
Paul