Loading ...
Sorry, an error occurred while loading the content.
 

Re: Using LB to access the temp folder

Expand Messages
  • rod_bird001
    ... To be clearer, Vista may not let you write to the Temp folder which may be buried in a User sub directory. Vista won t let you write files in a number
    Message 1 of 8 , Mar 1, 2008
      --- In libertybasic@yahoogroups.com, "Keith Nance" <fuego@...> wrote:
      >
      > Rodbird, thanks for the reply. It really doesn't matter if the temp
      > folder changes because information will change each time the program
      > runs,

      To be clearer, Vista may not let you write to the "Temp" folder which
      may be buried in a "User" sub directory. Vista won't let you write
      files in a number of places, "User" and "System" locations mainly. Most
      users will be unaware that they are in a "User" directory when they log
      in. Each user may have their own "Temp" file.

      So stay well away from all of that and create your own temp directory.
    • Stefan Pendl
      ... On Windows XP and 2000 each h user has its own temporary folder too, there is no difference in that direction. Windows Vista is just the first release,
      Message 2 of 8 , Mar 1, 2008
        >
        > To be clearer, Vista may not let you write to the "Temp" folder which
        > may be buried in a "User" sub directory. Vista won't let you write
        > files in a number of places, "User" and "System" locations
        > mainly. Most
        > users will be unaware that they are in a "User" directory
        > when they log
        > in. Each user may have their own "Temp" file.
        >

        On Windows XP and 2000 each h user has its own temporary folder too, there is no difference in that direction.
        Windows Vista is just the first release, which forces a developer to use the folder structure, which was introduced with Windows 95.
        There have always been dedicated folders for dedicated purpose, but developers have been too lazy to use them correctly.

        >
        > So stay well away from all of that and create your own temp directory.
        >

        There should be nothing wrong with using the temporary folder on Vista, littering a users machine by creating various folders
        anywhere on the disk is not really useful.
        Any user can run the disk-clean-up utility included with Windows to remove temporary files from the temporary folder.

        ---
        Stefan Pendl
      • Keith Nance
        If Vista will allow writing Temp files to a Temp folder then that wouldn t be a problem. That is, if Vista will allow the program to run from a CD. I
        Message 3 of 8 , Mar 1, 2008
          If Vista will allow writing "Temp" files to a "Temp" folder then that
          wouldn't be a problem. That is, if Vista will allow the program to
          run from a CD. I wasn't sure if that part had changed or not.

          Keith


          --- In libertybasic@yahoogroups.com, "Stefan Pendl"
          <pendl2megabit@...> wrote:
          >
          > >
          > > To be clearer, Vista may not let you write to the "Temp" folder which
          > > may be buried in a "User" sub directory. Vista won't let you write
          > > files in a number of places, "User" and "System" locations
          > > mainly. Most
          > > users will be unaware that they are in a "User" directory
          > > when they log
          > > in. Each user may have their own "Temp" file.
          > >
          >
          > On Windows XP and 2000 each h user has its own temporary folder too,
          there is no difference in that direction.
          > Windows Vista is just the first release, which forces a developer to
          use the folder structure, which was introduced with Windows 95.
          > There have always been dedicated folders for dedicated purpose, but
          developers have been too lazy to use them correctly.
          >
          > >
          > > So stay well away from all of that and create your own temp directory.
          > >
          >
          > There should be nothing wrong with using the temporary folder on
          Vista, littering a users machine by creating various folders
          > anywhere on the disk is not really useful.
          > Any user can run the disk-clean-up utility included with Windows to
          remove temporary files from the temporary folder.
          >
          > ---
          > Stefan Pendl
          >
        • rod_bird001
          Thanks for clarifying that Stefan, I had kept away from user directories after my early experience and reading advice on the forum. So it seems that if the
          Message 4 of 8 , Mar 2, 2008
            Thanks for clarifying that Stefan, I had kept away from "user"
            directories after my early experience and reading advice on the
            forum. So it seems that if the "User" runs the program we can use
            their "Temp" variable. That is much better than cluttering the disc.

            As to running from CD, well the discussions in the past have been
            about running Liberty BASIC Vx.x from CD or USB stick and the
            registration details it needs. If you are compiling to a stand
            alone .exe there should be no issue. (Other than file attributes ie
            files coming of a CD may be flagged read only) But that isn't Vista
            specific so you can test.

            I am a Vista convert by the way. It gets a lot of people riled but it
            looks and feels great and is very robust.


            temp$=GetEnvVar$("Temp")
            print temp$
            open temp$+"\rod.dat" for output as #rod
            print #rod,"test data"
            close #rod
            open temp$+"\rod.dat" for input as #rod
            line input #rod,text$
            print text$
            close #rod
            kill temp$+"\rod.dat"
            wait

            function GetEnvVar$(name$)
            'calls the api GetEnvironmentVariable to get the names
            environment variable

            lbuf$ = space$(255) + chr$(0)
            name$ = name$ + chr$(0)
            calldll #kernel32, "GetEnvironmentVariableA", name$ as ptr, _
            lbuf$ as ptr, _
            256 as long, _
            result as long
            if result = 0 then
            GetEnvVar$ = "Environment Variable Not Found"
            else
            GetEnvVar$ = left$(lbuf$,result)
            end if

            end function
          • Keith Nance
            Thank you both for the replies and Rodbird, thanks for the snippet. That ll give me a start. Keith
            Message 5 of 8 , Mar 2, 2008
              Thank you both for the replies and Rodbird, thanks for the snippet.
              That'll give me a start.

              Keith
            Your message has been successfully submitted and would be delivered to recipients shortly.