Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 01:04 05 Feb 2023 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Flash file system

Author Message
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1603
Posted: 11:22pm 23 Jan 2023
Copy link to clipboard 
Print this post

I am re writing my weather station code to use the flash file system instead of saving to the DS3231 flash
I'm trying to open a directory and save some values, I have
  Quote  open "A:/weather" for output as #1

and I get   Error : Entry is a dir
I find it hard as I can't find any examples, what am I doing wrong?
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 2930
Posted: 11:55pm 23 Jan 2023
Copy link to clipboard 
Print this post

Hi @palcal,

You don't "open a directory", you open a file in a directory.

Assuming the directory "A:/weather/" exists (if not then use MKDIR first) then:

open "A:/weather/my_file.txt" for output as #1


Best wishes,

Tom
CMM2 Welcome Tape, Creaky old text adventures
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1603
Posted: 12:05am 24 Jan 2023
Copy link to clipboard 
Print this post

Thanks I have never worked with directories so learning
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1603
Posted: 12:22am 24 Jan 2023
Copy link to clipboard 
Print this post

Thanks I have never worked with directories so learning
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1603
Posted: 01:17am 24 Jan 2023
Copy link to clipboard 
Print this post

OK got it working with..
open "A:/weather/data" for output as #1
print #1, rain
print #1, rainyest
print #1, rainyear
close #1
open "A:/weather/data" for input as#1
input #1, rain
input #1, rainyest
input #1, rainyear
close #1
print rain,rainyest,rainyear


Is there a way to Input and Output without using 3 lines, I tried...
print #1, rain, rainyest, rainyear
input #1, rain, rainyest, rainyear

but the second two entries returned zero
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5119
Posted: 01:25am 24 Jan 2023
Copy link to clipboard 
Print this post

'
rain =25
raintest = 100.5
rainyear = 1040.8

OPEN "A:/weather/data" FOR output AS #1
PRINT #1, rain;","; rainyest;","; rainyear
CLOSE #1
OPEN "A:/weather/data" FOR INPUT as#1
INPUT #1, rain, rainyest,rainyear
CLOSE #1
PRINT rain,rainyest,rainyear



You need to pout commas between the fields when printing to the file.

Jim
VK7JH
MMedit   MMBasic Help
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1603
Posted: 01:38am 24 Jan 2023
Copy link to clipboard 
Print this post

OK Jim thanks for that.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1603
Posted: 02:57am 24 Jan 2023
Copy link to clipboard 
Print this post

With my new Win 11 machine none of the function keys work with Teraterm, GFXterm or MMEdit.
the function key for screen brightness are OK.
Edited 2023-01-24 13:15 by palcal
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5119
Posted: 03:37am 24 Jan 2023
Copy link to clipboard 
Print this post

On some keyboards the function keys are dual purpose and you may have to switch them to "function keys"
This is very common on laptops and keyboards that are supplied by the big name manufacturers.
VK7JH
MMedit   MMBasic Help
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1603
Posted: 04:58am 24 Jan 2023
Copy link to clipboard 
Print this post

Forget it.
Edited 2023-01-24 15:02 by palcal
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2023