Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
user load bad file name check
#11
k thanks. whats with thing on the avatars hand?
Reply
#12
tiger-
Code:
on error goto lable
......
resume lable2

resume uses a lable like gosub and goto
Reply
#13
It doesn't have to
Check here: RESUME
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#14
sigh

use RESUME NEXT
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#15
you can use that too.
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#16
Quote:
Code:
ON ERROR GOTO erro
INPUT a$
OPEN a$ FOR INPUT AS #1
PRINT "ok file is there"
END

erro:
PRINT "File does not exist create it?";
INPUT yn$
IF LEFT$(LCASE$(yn$), 1) = "y" THEN
CLOSE
OPEN a$ FOR OUTPUT AS #1 'create file
CLOSE
ELSE
END
END IF
RESUME

now play arounf with it
If you run this while in graphical mode you'll get a scrambled image. Why don't you let DOS find out if a file exists. E.g. using:
  • Int 21/AH=4Eh
    DOS 2+ - FINDFIRST - FIND FIRST MATCHING FILE


    Input:
    AH = 4Eh
    AL = special flag for use by APPEND (refer to note below)
    CX = file attribute mask (see #01420 at AX=4301h) (bits 0 and 5 ignored)
    0088h (Novell DOS 7) find first deleted file
    DSBig GrinX -> ASCIZ file specification (may include path and wildcards)

    Return:
    CF clear if successful
    Disk Transfer Area filled with FindFirst data block (see #01626)
    CF set on error
    AX = error code (02h,03h,12h) (see #01680 at AH=59h/BX=0000h)

You can use this function to see if a file exists by specifying the file name it has to search for. If it finds the filename, the file exists. Else, it does not.
Reply
#17
Quote:
Code:
ON ERROR GOTO erro
INPUT a$
OPEN a$ FOR INPUT AS #1
PRINT "ok file is there"
END

erro:
PRINT "File does not exist create it?";
INPUT yn$
IF LEFT$(LCASE$(yn$), 1) = "y" THEN
CLOSE
OPEN a$ FOR OUTPUT AS #1 'create file
CLOSE
ELSE
END
END IF
RESUME

now play arounf with it
If you run this while in graphical mode you'll get a scrambled image. Why don't you let DOS find out if a file exists. E.g. using:
  • Int 21/AH=4Eh
    DOS 2+ - FINDFIRST - FIND FIRST MATCHING FILE


    Input:
    AH = 4Eh
    AL = special flag for use by APPEND (refer to note below)
    CX = file attribute mask (see #01420 at AX=4301h) (bits 0 and 5 ignored)
    0088h (Novell DOS 7) find first deleted file
    DSBig GrinX -> ASCIZ file specification (may include path and wildcards)

    Return:
    CF clear if successful
    Disk Transfer Area filled with FindFirst data block (see #01626)
    CF set on error
    AX = error code (02h,03h,12h) (see #01680 at AH=59h/BX=0000h)

    Format of FindFirst data block:
    Offset Size Description (Table 01626)
    ---PC-DOS 3.10, PC-DOS 4.01, MS-DOS 3.2/3.3/5.0---
    00h BYTE drive letter (bits 0-6), remote if bit 7 set
    01h 11 BYTEs search template
    0Ch BYTE search attributes
    ---DOS 2.x (and some DOS 3.x???)---
    00h BYTE search attributes
    01h BYTE drive letter
    02h 11 BYTEs search template
    ---WILDUNIX.COM---
    00h 12 BYTEs 15-character wildcard search pattern and drive letter (packed)
    0Ch BYTE search attributes
    ---DOS 2.x and most 3.x---
    0Dh WORD entry count within directory
    0Fh DWORD pointer to DTA???
    13h WORD cluster number of start of parent directory
    ---PC-DOS 4.01, MS-DOS 3.2/3.3/5.0---
    0Dh WORD entry count within directory
    0Fh WORD cluster number of start of parent directory
    11h 4 BYTEs reserved
    ---OS/2 MVDM---
    00h WORD "OS2_BMP_handle"
    02h WORD "OS2_LastEnt"
    04h DWORD "OS2_Checksum"
    08h BYTE "OS2_usi_flag"
    09h DWORD used by DOS emulator for second pass for volume-label searches
    0Dh WORD (ret) "DOS_LastEnt" entry count within directory
    0Fh BYTE OS/2 Processed-FindFirst flag
    00h FindFirst processed by DOS
    42h FindFirst processed by OS/2
    10h 5 BYTEs reserved for future use
    ---all versions, documented fields---
    15h BYTE attribute of file found
    16h WORD file time (see #01665 at AX=5700h)
    18h WORD file date (see #01666 at AX=5700h)
    1Ah DWORD file size
    1Eh 13 BYTEs ASCIZ filename+extension


You can use this function to see if a file exists by specifying the file name it has to search for. If it finds the filename, the file exists. Else, it does not.
Reply
#18
what was that :???:
Reply
#19
Quote:k thanks. whats with thing on the avatars hand?

Heh, that's a bad enlargement of a smiley doing a "talk to the hand" routine. But I suck at enlarging, but since it's been my avatar for so long I don't think I'll change it Smile
Reply
#20
whats a enlarging? it looks like a bad dragon
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)