Author Topic: file paths  (Read 3542 times)

0 Members and 1 Guest are viewing this topic.

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
file paths
« on: October 07, 2020, 11:23:33 am »
Hello

I have need to put files my software creates in different directories. I have read somethings but my mind is not in the mood this morning to comprehend such high tech writings LOL so if someone would kindly point me in the correct directions i would appreciate it.

Thanks in advance

Badger

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: file paths
« Reply #1 on: October 07, 2020, 11:50:20 am »
First of all are you talking about .bas files made with QB64?

I have to make directories, usually with Windows Explorer then I can save .bas files in the directories I made.

Then I make sure there is a bullet under Menu > Run > Output EXE to Source Folder,
 so I can Run the files out of different folders.

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
Re: file paths
« Reply #2 on: October 07, 2020, 12:08:03 pm »
hello

in my program i want to set files paths for data txt files my program will generate. there will be a menu options for this setup. I want to be able to enter the files paths into a random file then let the system decide if they exists if if not create them. i hope i am being clear here if you have a questions about what i have typed please please asks.

Badger

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: file paths
« Reply #3 on: October 07, 2020, 12:08:44 pm »
First of all are you talking about .bas files made with QB64?

I have to make directories, usually with Windows Explorer then I can save .bas files in the directories I made.

Then I make sure there is a bullet under Menu > Run > Output EXE to Source Folder,
 so I can Run the files out of different folders.

You don't have to; we have a command for that: http://www.qb64.org/wiki/MKDIR

Generally speaking, all you need to do is type the file path into your program, where you open/access a file, along with the name.

Instead of:  OPEN "temp.txt" FOR INPUT AS #1

You would:  OPEN "C:\my dir\my subdir\temp.txt" FOR INPUT AS #1
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
Re: file paths
« Reply #4 on: October 07, 2020, 12:09:25 pm »
bplus

please read my above post for what i need. i am sorry i was not more clear. as i said my mind seems a bit befuddled this morning

Badger

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: file paths
« Reply #5 on: October 07, 2020, 12:12:47 pm »
hello

in my program i want to set files paths for data txt files my program will generate. there will be a menu options for this setup. I want to be able to enter the files paths into a random file then let the system decide if they exists if if not create them. i hope i am being clear here if you have a questions about what i have typed please please asks.

Badger

DataPath$ = "C:\my dir\my subdir\"

IF _FILEEXISTS(DataPath$ + "temp.txt") THEN
     'temp.txt exists inside the datapath
ELSE
    'create the file
    OPEN DataPath$ + "temp.txt" FOR OUTPUT AS #1
    PRINT #1, "ScreenWidth = 640"
    PRINT #1, "ScreenHeight = 480"
    CLOSE
END IF
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
Re: file paths
« Reply #6 on: October 07, 2020, 12:20:16 pm »
SMcneill

thats that give me a direction just have to figure out how the program should react on startup when nothing is set. I want the data files in there own directories random file, user info txt file, inventory text files and point of sale information in another.

Thanks very much

Badger