[futurebasic] Re: [FB] File Basics?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : March 2002 : Group Archive : Group : All Groups

From: Rod Steel <rod.steel@...>
Date: Tue, 26 Mar 2002 14:40:15 +0000

Here is some code, kindly supplied by Alain Pastor, that pretty well does
what you are looking for. I think. (the folder was HD:QuizFiles)

Rod Steel

Clear Local Mode
Local Fn GetSysVolName$
  Dim As Str63 vName
  Dim pb.128

  pb.ioNamePtr&      = @vName
  pb.ioVolIndex%     = 1
  Long If Fn PBHGetVInfoSync(pb) <> _noErr
    vName = ""
  End If
End Fn = vName

Clear Local Mode
Local Fn CheckFile(fileName As Str63, wdRefNum As Int)
  Dim pb.128

  pb.ioNamePtr&  = @fileName
  pb.ioVRefNum%  = wdRefNum
  #If CarbonLib
    Fn FBWDToPBWD(pb)
End Fn = Fn PBHGetFInfoSync (pb)

Local Fn ShowQuizFile(index As Int)
  Dim As Str63 folName,fileName
  Dim As Int   fVRN

  folName = Fn GetSysVolName$ + ":QuizFiles"
  fVRN    = Folder(folName,System(_sysVol))

  If fVRN = 0 Then Print "No input file folder":Stop

  fileName = "Quiz Questions" + Str$(Index)
  Print fileName;

  Long If Fn CheckFile(fileName,fVRN) = _noErr
    Print " exists!"
    REM open input file
    // OPEN "I",fileInQs,fileName,,fVRN
    Print " doesn't exist!"
  End If
End Fn

// main test
Window 1
Dim i
For i = 1 To 5
  Fn ShowQuizFile(i)

Until Fn Button


> I know where a file is (hd:serverfolder:ftp:pub) and just want to read this
> file in while also saving is to a known folder (hd:serverfolder:userk).
> However I want to do this without any user input i.e. going through the
> typical dialog box Files$ command. Any hints? Of course I want this to work
> under OS X and classic.
> Thanks in advance,
> Ken
> --
> To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>