Menu

Reading and writing sequential files on disk

2020-04-20
2020-04-28
1 2 > >> (Page 1 of 2)
  • Ezio Pagliarino

    Ezio Pagliarino - 2020-04-20

    Hello to all of you. Wanting to resurrect an old program that I wrote about 35 years ago, I came across some instructions for opening and writing sequential files on diskette.
    There are instructions such as: OPEN "R", # 2, "xxxfile", 64 .... FIELD # 2,16 as co $, 4 as p1 $, etc.
    PC-Basic on these instructions gives me error. What is the solution? I don't know what I have to say to the software to write and read sequential files.
    Thank you for your kindness.

     
    • Marc 'BlackJack' Rintsch

      How should anybody know what the solution is? You don't say what the exact code is, nor what the exact error is.

       
  • Ezio Pagliarino

    Ezio Pagliarino - 2020-04-22

    17/5000
    In this listing:
    .....
    ......
    20 OPEN "PNfile" AS #5 LEN=76
    25 FIELD #5,3 AS cos$,8 AS dt$,50 AS desc$,15 AS import$
    .....
    ......
    The run command generates this warning:
    Bad file number in 20

     
  • Tuxtoo

    Tuxtoo - 2020-04-22

    Ezio, I am afraid I don't know the solution to your problem either, however you may find the solution in the online GW-BASIC User Guide here. You will also find more GW-BASIC resources here which I am sure you will find helful.

     
  • Ezio Pagliarino

    Ezio Pagliarino - 2020-04-22

    Thanks everyone for the help.

     
  • Ezio Pagliarino

    Ezio Pagliarino - 2020-04-22

    Sorry friends, I would have another problem, always connected to the first question. It is possible to increase the number of files by going to settings that should be on Library / Application Support / PCBasic. The problem arises from the fact that on my iMac I don't have the PCBasic folder where it should be. The application was installed from a dmg file and placed in the User folder. How can I change the settings? Sorry again for the inconvenience.
    Thank you

     
    • Rob Hagemans

      Rob Hagemans - 2020-04-22

      The settings file should be in that place even if you install from DMG

       
  • Smithdoor

    Smithdoor - 2020-04-22

    Error

     

    Last edit: Smithdoor 2020-04-22
  • Smithdoor

    Smithdoor - 2020-04-22

    Here simple way of writing to disk.
    Works good for short files and simple
    The downside is no filr number and keep reading .

    Here simple way of writing to disk.
    Works good for short files and simple
    The downside is no file number and keep reading .

    10 ' file writing and reading
    20 '.
    Write to disk
    30 ' File name is "test"
    40 '
    60 OPEN "test" FOR OUTPUT AS #3: REM ----------- open test -------
    70 '
    input data to write to disk
    80 INPUT " write some data to file ";AB$
    90 ' Data writing to disk
    100 PRINT #3, "
    * Write file to Disk ***"
    110 PRINT #3, " Notepad can be used to edit this file"
    120 PRINT #3, AB$
    130 PRINT #3, " ===== End of List "
    135 '
    writing and closing #3
    140 CLOSE 3
    150 PRINT "done"
    160 '
    170 '. * Read data from disk
    175 '
    178 '
    To read the file from disk
    180 INPUT " press enter";A$
    220 OPEN "test" FOR INPUT AS #2: REM --- open file test file
    230 IF EOF(2) THEN 250: REM ----- End of file then goto 5000
    240 AIN$ = INPUT$(1, #2): REM ----- get data from test
    250 TY$=TY$+AIN$:T=T+1
    260 IF T>60 THEN 280
    270 GOTO 230
    280 PRINT TY$
    290 TY$="":T=0:TN=TN+1
    300 IF TN>1 THEN END
    310 GOTO 230
    

     
  • Smithdoor

    Smithdoor - 2020-04-22

    This program show how use this way

     
  • Ezio Pagliarino

    Ezio Pagliarino - 2020-04-23

    Thanks for the help, I will follow the proposed scheme.

     
  • Ezio Pagliarino

    Ezio Pagliarino - 2020-04-23

    Sorry again, but wanting to get to the bottom of the question and looking for the PCBASIC.INI file, I did a test. I downloaded pcbasic-v1.2.14, PCBASIC 2.0.2 and pcbasic 15.03.1.
    Well only in version 15.03.1 I found the PCBASIC.INI file in the contents of the package. Too bad that this version is not loaded from the Mac and that in the file there is no way to increase the number of files. How do I edit the .INI file?
    Thank you, thank you, thank you again for your availability.

     
  • Smithdoor

    Smithdoor - 2020-04-23

    I use notepad but that is for Windows 10 64bit
    But are you saying you have MAC

     
  • Smithdoor

    Smithdoor - 2020-04-23

    I use notepad but that is for Windows 10 64bit
    But are you saying you have MAC

     
  • Ezio Pagliarino

    Ezio Pagliarino - 2020-04-24

    Yes, Mac 2019. PCBasic is installed in the user folder.

     
  • Smithdoor

    Smithdoor - 2020-04-24

    The last time used Apple was at store 1981
    They out stock of Apple and just got the IBM with DOS 1.1 and gave a great deal

    I do not know what Mac's name is for NotePad
    It simple to change the PCBASIC.INI
    I make a back copy be for making changes.
    If make change it does not work you use backup to go back in time

    OS X
    ~/Library/Application Support/pcbasic-2.0/PCBASIC.INI

    http://robhagemans.github.io/pcbasic/doc/2.0/#settings

     
  • Ezio Pagliarino

    Ezio Pagliarino - 2020-04-25

    Thanks for the indications, I did exactly as they say in the guide and for windows it worked perfectly, while in Mac there is no installation of PCBASIC as in windows but only an app to run that does not have the configuration file.

     
  • Smithdoor

    Smithdoor - 2020-04-25

    Some programs will work without the INI file but you can add.
    It does need to be in the right spot to work.

    Here what the INI file looks like

    **# PC-BASIC configuration file.

    Edit this file to change your default settings or add presets.

    Changes to this file will not affect any other users of your computer.

    All lines starting with # are comments and have no effect.

    Thus, to use one of the example options below, you need to remove the # at the start of the line.

    [pcbasic]

    Use the [pcbasic] section to specify options you want to be enabled by default.

    See the documentation or run pcbasic -h for a list of available options.

    for example (for version '2.0.2'):

    allow-code-poke=False

    aspect=4,3

    border=5

    caption=PC-BASIC

    cas1=

    choices: 1258, 437, 720, 737, 775, 806, 850, 851, 852, 853, 855, 856, 857, 858, 860, 861, 862, 863, 864, 865, 866, 868, 869, 874, 932, 934, 936, 938, 949, 950, alternativnyj, armscii8a, big5-2003, big5-hkscs, georgian-academy, georgian-ps, iransystem, iscii-as, iscii-be, iscii-de, iscii-gu, iscii-ka, iscii-ma, iscii-or, iscii-pa, iscii-ta, iscii-te, kamenicky, koi8-r, koi8-ru, koi8-u, mazovia, mik, osnovnoj, pascii, ruscii, russup3, russup4ac, russup4na, viscii

    codepage=437

    com1=

    com2=

    config=

    convert= A

    ctrl-c-break=True

    current-device=

    debug=False

    dimensions=

    double=False

    exec=

    extension=

    choices: cga, cgathin, freedos, mda, olivetti, tandy1, tandy2, unifont, univga, vga

    font=tandy2,univga,freedos

    fullscreen=False

    help=False

    hide-listing=65535

    hide-protected=False

    input=

    choices: , none, cli, text, graphical, ansi, curses, pygame, sdl2

    interface=

    keys=

    load=

    logfile=

    lpt1=PRINTER:

    lpt2=

    lpt3=

    max-files=3

    max-memory=65534,4096

    max-reclen=128

    choices: rgb, composite, green, amber, grey, mono

    monitor=rgb

    mount=

    mouse-clipboard=True

    options=

    output=

    peek=

    prevent-close=False

    quit=False

    reserved-memory=3429

    resume=False

    run=

    choices: smooth, native, crisp

    scaling=smooth

    serial-buffer-size=256

    shell=

    soft-linefeed=False

    choices: , none, beep, portaudio, interface

    sound=

    state=

    choices: advanced, pcjr, tandy

    syntax=advanced

    term=

    text-encoding=

    choices: 40, 80

    text-width=80

    utf8=False

    version=False

    choices: vga, ega, cga, cga_old, mda, pcjr, tandy, hercules, olivetti

    video=hercules

    video-memory=262144

    wait=False

    To add presets, create a section header between brackets and put the

    options you need below it, like this:

    [your_preset]

    border=0

    You will then be able to load these options with --preset=your_preset.

    If you choose the same name as a system preset, PC-BASIC will use your

    ****

     
  • Ezio Pagliarino

    Ezio Pagliarino - 2020-04-26

    Thanks, now I will try where to place the INI file on the Mac

     
  • Ezio Pagliarino

    Ezio Pagliarino - 2020-04-26

    I tried to insert the configuration file in several places in the Mac folders but unfortunately it does not read it and max-files remains at 3.
    I will only use it in windows where it works fine.

     
    • Smithdoor

      Smithdoor - 2020-04-26

      There is one other INI file you change.I can till where on Windows 10 only.MAC has this INI file in PCBasic In Window is in User files.If you make mistake here you may need reinstall.
      FYI I will make changes here myself, I also make changes in my Reg on computer too and had to reinstall Windows.

      Sent from Yahoo Mail on Android

      On Sun, Apr 26, 2020 at 1:23 AM, Ezio Pagliarinogigigenio@users.sourceforge.net wrote:
      I tried to insert the configuration file in several places in the Mac folders but unfortunately it does not read it and max-files remains at 3.
      I will only use it in windows where it works fine.

      Reading and writing sequential files on disk

      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/pcbasic/discussion/general/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       
  • Ezio Pagliarino

    Ezio Pagliarino - 2020-04-27

    thanks

     
  • Rob Hagemans

    Rob Hagemans - 2020-04-27

    PC-BASIC automatically generates the PC-BASIC.INI file on the first time it is run, if it is not already there, so there is no need to place it yourself. It is always in the location specified in the documentation and earlier in this thread - whether you run from DMG or in the user folder or somewhere else.

    There are no settings files for PC-BASIC in other locations and there are no settings for PC-BASIC in the registry. If you edit other files or the registry then you are changing settings for other programs and/or for your operating system. You may well damage something but you will not change PC-BASIC's behaviour this way.

    The location of the settings file is specified clearly in the documentation. Please just try and locate this file by specifying the folder address in Finder (using Go > Go To Folder). Then you can edit the INI file in TextEdit.

    The DNG is the standard way to run on a Mac and I have tested this, so I am quite certain it works if you follow the documentation.

     
  • Rob Hagemans

    Rob Hagemans - 2020-04-27

    https://robhagemans.github.io/pcbasic/doc/1.2/#settings

    ~/Library/Application Support/pcbasic-1.2/PCBASIC.INI
    

    Note in particular the tilde (~) in front. It is important, this means the address is under your home directory. If you paste the full address as shown including the tilde it will work. If you omit the tilde it is a different location under the root directory, and it will not work.

     
1 2 > >> (Page 1 of 2)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.