May 29, 2024, 04:48:11 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


opening files on vista

Started by chris, August 10, 2008, 07:55:20 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

chris

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

Ionic Wind Support Team

Chris,
Why the four slashes?

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

Ionic Wind Support Team

chris

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

Ionic Wind Support Team

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.

Ionic Wind Support Team

chris

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

Ionic Wind Support Team

Chris,
Sorry.  My fault.  OpenFile returns 0 on success.

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

Paul.
Ionic Wind Support Team

chris

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

Ionic Wind Support Team

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
Ionic Wind Support Team