I am having a problem with an OPEN statment bombing out. It is suppose to search a junk.tmp file for a string PN$=0992 then passes to FOUNDIT. The program just exits.
JUNKCHECKIT:
dro$ = "dir f:\" + PN$ + " > junk.tmp"
SHELL "cmd /c " + dro$
OPEN "junk.tmp" FOR INPUT AS #1
DO UNTIL EOF(1)
LINE INPUT #1, a$
IF INSTR(a$, PN$) <> 0 THEN
x$ = RTRIM$(LTRIM$(MID$(a$, 40, 4)))
IF x$ = PN$ THEN GOTO FOUNDIT
END
END IF
LOOP
CLOSE #1
RETURN
=================================
JUNK.TMP
Volume in drive F is DATA
Volume Serial Number is F0CA-6319
Directory of f:\0992
12/15/2008 02:40 PM <DIR> .
12/15/2008 02:40 PM <DIR> ..
12/15/2008 09:39 AM <DIR> 0992Junk
11/17/2008 01:22 PM 9,654,272 0992_Central.rvt
11/17/2008 01:22 PM <DIR> 0992_Central_backup
10/06/2008 10:17 AM <DIR> 0992_Correspondence
Simple OPEN problem
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
INSTR returns the start position of the text you are looking for, but you are not using that position in the MID$ statement.
According to your directory listing, there is no file named "0992" in that folder, so it is not in the "junk.tmp" file listing. Try using "0992*.*"
Ted
According to your directory listing, there is no file named "0992" in that folder, so it is not in the "junk.tmp" file listing. Try using "0992*.*"
Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0