Qbasicnews.com
April 05, 2020, 08:25:14 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: 1 [2] 3
  Print  
Author Topic: Another Question - File opening and writing  (Read 6890 times)
Glenn
I hold this place together
*****
Posts: 786



WWW
« Reply #15 on: June 06, 2003, 09:42:18 AM »

with the GOTO statement.  The examples using "." in the variable names involved *user-defined variables*.
Logged

ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
casonon
Member
*
Posts: 28


« Reply #16 on: June 06, 2003, 10:09:24 AM »

Glenn,

How would I correct this problem.  I am still a little in the dark on how this whole thing works with writing the files and the information to the files.

Thanks
Logged
Neo
Na_th_an
*****
Posts: 2150



« Reply #17 on: June 06, 2003, 10:14:31 AM »

Quote from: "casonon"
Ok. Using the methods posted by toonski & phydaux, I arrived at the follwing code.

""""""""""""""""""""""""""""""""
NAMEVERIFY:
LG.DT$ = DATE$
CLS
PRINT "NAME : "; LG.PERNAME$
PRINT
PRINT "DATE : "; LG.DT$
PRINT
PRINT "PART NAME : "; LG.PNAME$
PRINT
PRINT "PROJECT : "; LG.PRJNAME$
PRINT
PRINT "PROJECT TITLE : "; LG.PRONAME$
PRINT
PRINT "IS THIS INFORMATION CORRECT (y/n)"
DO
   KEY$ = INKEY$
   IF KEY$ = "y" OR KEY$ = "Y" THEN
      GOTO WRITENEW
   END IF
   IF KEY$ = "n" OR KEY$ = "N" THEN
      GOTO NEWPARTNUMBER
   END IF
LOOP WHILE KEY$ < "Y" OR KEY$ > "N"


WRITENEW:
TYPE INFO
   PERNAME AS STRING * 10
   DT AS STRING * 8
   PNAME AS STRING * 35
   PRJNAME AS STRING * 12
   PRONAME AS STRING * 25
END TYPE

DIM LG AS INFO

OPEN "C:\TEST.DAT" FOR BINARY AS #1
   SEEK #1, LOF(1) + 1
   PUT #1,, LG
CLOSE#1
""""""""""""""""""""""""""""""""""""""""
Now, I get an error when trying to run this that says "Identifer can not contain period."  which I don't understand since you guys have them in your examples.  Please advise what I need to do to fix this.

Thanks


Changed text is red

The error you got was summoned from the fact that you used reserved words in your variable and lable names. This is, of course, not allowed.
Logged
Glenn
I hold this place together
*****
Posts: 786



WWW
« Reply #18 on: June 06, 2003, 10:22:23 AM »

(Just take out the "." in the offending labels.)
Logged

ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Neo
Na_th_an
*****
Posts: 2150



« Reply #19 on: June 06, 2003, 10:27:44 AM »

A mistake often made by starting programmers, once you know you don't do it ever again Smiley
Logged
casonon
Member
*
Posts: 28


« Reply #20 on: June 06, 2003, 10:45:42 AM »

Ok..
I changed the code to be what you said. And I get the same error.  I should have told you were the error was.  It wasn't at the name.verify:. It was at the LG.PERNAME$
""""""""""""""""""""
NAMEVERIFY:
LG.DT$ = DATE$
CLS
PRINT "NAME : "; LG.PERNAME$  <---- HERE
PRINT
""""""""""""""""""""

Any ideas?
Thanks
Logged
Neo
Na_th_an
*****
Posts: 2150



« Reply #21 on: June 06, 2003, 10:47:28 AM »

:roll:
Logged
Glenn
I hold this place together
*****
Posts: 786



WWW
« Reply #22 on: June 06, 2003, 11:02:09 AM »

defined in a user-defined type and is LG typed as that type?   (I'm not sure you can use a variable length string in a user-defined type, but I'll go perform an experiment in a minute.)
Logged

ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Mango
Wandering Guru
***
Posts: 360



« Reply #23 on: June 06, 2003, 11:26:53 AM »

Quote from: "Glenn"
(I'm not sure you can use a variable length string in a user-defined type, but I'll go perform an experiment in a minute.)


I you can't use variable length string in a user-defined type.  I just tried to find the quote from the *original, paper-bound qb4.5 manual* sitting at my feet...but no luck...I do recall having read this though...although I'm not smart enough to use user-defined types...
Logged
Glenn
I hold this place together
*****
Posts: 786



WWW
« Reply #24 on: June 06, 2003, 11:44:09 AM »

However, I suspect that casanon didn't actually put PERNAME$ in a user-defined type because he would have gotten a different error message in that case.
Logged

ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
casonon
Member
*
Posts: 28


« Reply #25 on: June 06, 2003, 12:19:38 PM »

Ok. Here is the entire code.  I want to place the infromation that is in the nameverify: area into the file.

Code:

OPTION.PAGE:
CLS
PRINT TAB(25); "IRON MOUNTAIN PART LOG"
PRINT
PRINT "1. OBTAIN NEW PART NUMBER"
PRINT "2. SEARCH PART LOG"
PRINT "3. VIEW ENTIRE PROJECT PART LOG"
DO
KEY$ = INKEY$
LOOP WHILE KEY$ < "1" OR KEY$ > "4"

SELECT CASE KEY$
CASE "1"
GOTO NEW.PART.NUMBER
CASE "2"
CLS
PRINT "2 WORKS"
CASE "3"
CLS
PRINT "3 WORKS"
END SELECT

NEW.PART.NUMBER:
CLS
INPUT "PLEASE ENTER YOUR INITALS"; LG.PERNAME$
CLS
PRINT
PRINT "SELECT A PROJECT"
PRINT
PRINT " 1. BEDRAILS"
PRINT " 2. BOUNCERS"
PRINT " 3. CARSEATS"
PRINT " 4. HIGH CHAIRS"
PRINT " 5. HOOK ON CHAIRS"
PRINT " 6. JUMPERS"
PRINT " 7. PNP"
PRINT " 8. STROLLERS"
PRINT " 9. WALKERS AND ENTERTAINERS"
DO
KEY$ = INKEY$
LOOP WHILE KEY$ < "1" OR KEY$ > "9"

SELECT CASE KEY$
CASE "1"
LG.PRJNAME$ = "BEDRAILS"
CASE "2"
LG.PRJNAME$ = "BOUNCERS"
CASE "3"
LG.PRJNAME$ = "CARSEATS"
CASE "4"
LG.PRJNAME$ = "HIGH CHAIRS"
CASE "5"
LG.PRJNAME$ = "HOOK ON CHAIRS"
CASE "6"
LG.PRJNAME$ = "JUMPERS"
CASE "7"
LG.PRJNAME$ = "PLAY YARDS"
CASE "8"
LG.PRJNAME$ = "STROLLERS"
CASE "9"
LG.PRJNAME$ = "WALKERS & ENTERTAINERS"
END SELECT

CLS
INPUT "ENTER THE TITLE OF THE PROJECT"; LG.PRONAME$
CLS
PRINT
PRINT " 1. ENTER YOUR OWN PART NAME"
PRINT " 2. USE NAME WIZARD"
DO
KEY$ = INKEY$
LOOP WHILE KEY$ < "1" OR KEY$ > "2"

SELECT CASE KEY$
CASE "1"
GOTO NAMING
CASE "2"
GOTO NAME.WIZARD
END SELECT

NAMING:
CLS
INPUT "ENTER THE NAME FOR YOUR PART"; LG.PNAME$
GOTO NAMEVERIFY

NAME.WIZARD:
CLS
PRINT
PRINT " 1. TUBE"
PRINT " 2. TRAY"
PRINT " 3. HOUSING"
PRINT " 4. WHEEL"
PRINT
INPUT "SELECT A PRIMARY DESCRIPTIVE NAME FOR YOUR PART"; DES.1$
SELECT CASE DES.1$
CASE "1"
NAME.1$ = "TUBE"
GOTO TUBE.WIZ
CASE "2"
NAME.1$ = "TRAY"
GOTO TRAY.WIZ
CASE "3"
NAME.1$ = "HOUSING"
GOTO HOUS.WIZ
CASE "4"
NAME.1$ = "WHEEL"
GOTO WHEEL.WIZ
CASE ELSE
NAME.1$ = DES.1$
GOTO OWN.WIZ.1
END SELECT
END

TUBE.WIZ:
CLS
PRINT
PRINT " 1. STROLLER"
PRINT " 2. HIGH CHAIR"
PRINT " 3. SWING"
PRINT " 4. PLAY YARD"
PRINT
INPUT "SELECT A SECONDARY DESCRIPTIVE NAME FOR YOUR PART OR ENTER YOUR OWN"; DES.2$
SELECT CASE DES.2$
CASE "1"
NAME.2$ = "STROLLER"
CASE "2"
NAME.2$ = "HIGH CHAIR"
CASE "3"
NAME.2$ = "SWING"
CASE "4"
NAME.2$ = "PNP"
CASE ELSE
NAME.2$ = DES.2$
END SELECT
CLS
PRINT
PRINT " 1. FRONT LEG"
PRINT " 2. REAR LEG"
PRINT " 3. BASKET TUBE"
PRINT " 4. CROSS TUBE"
PRINT
INPUT "SELECT A LOCATION FOR THE TUBE OR ENTER A DESCRIPTIVE AREA OF YOUR OWN"; DES.3$
SELECT CASE DES.3$
CASE "1"
NAME.3$ = "FRONT LEG"
CASE "2"
NAME.3$ = "REAR LEG"
CASE "3"
NAME.3$ = "BASKET TUBE"
CASE "4"
NAME.3$ = "CROSS TUBE"
CASE ELSE
NAME.3$ = DES.3$
END SELECT
GOTO NAME.VERIFY.WIZ

TRAY.WIZ:
CLS
PRINT
PRINT " 1. HIGH CHAIR"
PRINT " 2. STROLLER"
PRINT " 3. SWING"
PRINT
INPUT "SELECT A SECONDARY DESCRIPTIVE NAME FOR YOUR PART OR ENTER YOUR OWN"; DES.2$
SELECT CASE DES.2$
CASE "1"
NAME.2$ = "HIGH CHAIR"
CASE "2"
NAME.2$ = "STROLLER"
CASE "3"
NAME.2$ = "SWING"
CASE ELSE
NAME.2$ = DES.2$
END SELECT
CLS
PRINT
PRINT " 1. PARENT"
PRINT " 2. CHILD"
PRINT " 3. PLAY"
PRINT " 4. TOY"
PRINT
INPUT "SELECT A LOCATION FOR THE TRAY OR ENTER A DESCRIPTIVE AREA OF YOUR OWN"; DES.3$
SELECT CASE DES.3$
CASE "1"
NAME.3$ = "PARENT"
CASE "2"
NAME.3$ = "CHILD"
CASE "3"
NAME.3$ = "PLAY"
CASE "4"
NAME.3$ = "TOY"
CASE ELSE
NAME.3$ = DES.3$
END SELECT
GOTO NAME.VERIFY.WIZ

HOUS.WIZ:
CLS
PRINT
PRINT " 1. STROLLER"
PRINT " 2. HIGH CHAIR"
PRINT " 3. SWING"
PRINT " 4. PLAY YARD"
PRINT
INPUT "SELECT A SECONDARY DESCRIPTIVE NAME FOR YOUR PART OR ENTER YOUR OWN"; DES.2$
SELECT CASE DES.2$
CASE "1"
NAME.2$ = "STROLLER"
CASE "2"
NAME.2$ = "HIGH CHAIR"
CASE "3"
NAME.2$ = "SWING"
CASE "4"
NAME.2$ = "PNP"
CASE ELSE
NAME.2$ = DES.2$
END SELECT
CLS
PRINT
PRINT " 1. FOLD"
PRINT " 2. SUPPORT"
PRINT " 3. SWIVEL"
PRINT " 4. RECLINE"
PRINT
INPUT "SELECT A LOCATION FOR THE HOUSING OR ENTER A DESCRIPTIVE AREA OF YOUR OWN"; DES.3$
SELECT CASE DES.3$
CASE "1"
NAME.3$ = "FOLD"
CASE "2"
NAME.3$ = "SUPPORT"
CASE "3"
NAME.3$ = "SWIVEL"
CASE "4"
NAME.3$ = "RECLINE"
CASE ELSE
NAME.3$ = DES.3$
END SELECT
GOTO NAME.VERIFY.WIZ

WHEEL.WIZ:
CLS
PRINT
PRINT " 1. STROLLER"
PRINT " 2. HIGH CHAIR"
PRINT " 3. PLAY YARD"
PRINT
INPUT "SELECT A SECONDARY DESCRIPTIVE NAME FOR YOUR PART OR ENTER YOUR OWN"; DES.2$
SELECT CASE DES.2$
CASE "1"
NAME.2$ = "STROLLER"
CASE "2"
NAME.2$ = "HIGH CHAIR"
CASE "3"
NAME.2$ = "PLAY YARD"
CASE ELSE
NAME.2$ = DES.2$
END SELECT
CLS
PRINT
PRINT " 1. 6"
PRINT " 2. 7"
PRINT " 3. 8"
PRINT " 4. 8.5"
PRINT
INPUT "SELECT A DIAMETER FOR THE WHEEL OR ENTER A DIAMETER OF YOUR OWN"; DES.3$
SELECT CASE DES.3$
CASE "1"
NAME.3$ = "6"
CASE "2"
NAME.3$ = "7"
CASE "3"
NAME.3$ = "8"
CASE "4"
NAME.3$ = "8.5"
CASE ELSE
NAME.3$ = DES.3$
END SELECT
GOTO NAME.VERIFY.WIZ

OWN.WIZ.1:
CLS
PRINT
PRINT " 1. BEDRAILS"
PRINT " 2. BOUNCERS"
PRINT " 3. CARSEATS"
PRINT " 4. HIGH CHAIRS"
PRINT " 5. HOOK ON CHAIRS"
PRINT " 6. JUMPERS"
PRINT " 7. PNP"
PRINT " 8. STROLLERS"
PRINT " 9. WALKERS AND ENTERTAINERS"
PRINT
INPUT "SELECT A SECONDARY DESCRIPTIVE NAME FOR YOUR PART OR ENTER YOUR OWN"; DES.2$
SELECT CASE DES.2$
CASE "1"
NAME.2$ = "BEDRAIL"
CASE "2"
NAME.2$ = "BOUNCER"
CASE "3"
NAME.2$ = "CARSEAT"
CASE "4"
NAME.2$ = "HIGH CHAIR"
CASE "5"
NAME.2$ = "HOOK ON CHAIR"
CASE "6"
NAME.2$ = "JUMPER"
CASE "7"
NAME.2$ = "PLAY YARD"
CASE "8"
NAME.2$ = "STROLLER"
CASE "9"
NAME.2$ = "WALKER - ENTERTAINER"
CASE ELSE
NAME.2$ = DES.2$
END SELECT
CLS
INPUT "ENTER A LOCATION FOR THE PART"; DES.3$
NAME.3$ = DES.3$
GOTO NAME.VERIFY.WIZ

NAME.VERIFY.WIZ:
S$ = "-"
CLS
PRINT
PRINT "NEW PART NAME : "; NAME.1$; "-"; NAME.2$; "-"; NAME.3$
PRINT
PRINT "IS THIS INFORMATION CORRECT (y/n)"
DO
KEY$ = INKEY$
IF KEY$ = "y" OR KEY$ = "Y" THEN
LG.PNAME$ = NAME.1$ + S$ + NAME.2$ + S$ + NAME.3$
GOTO NAMEVERIFY
END IF
IF KEY$ = "n" OR KEY$ = "N" THEN
GOTO NAME.WIZARD
END IF
LOOP WHILE KEY$ < "Y" OR KEY$ > "N"

NAMEVERIFY:
LG.DT$ = DATE$
CLS
PRINT "NAME : "; LG.PERNAME$
PRINT
PRINT "DATE : "; LG.DT$
PRINT
PRINT "PART NAME : "; LG.PNAME$
PRINT
PRINT "PROJECT : "; LG.PRJNAME$
PRINT
PRINT "PROJECT TITLE : "; LG.PRONAME$
PRINT
PRINT "IS THIS INFORMATION CORRECT (y/n)"
DO
KEY$ = INKEY$
IF KEY$ = "y" OR KEY$ = "Y" THEN
GOTO WRITENEW
END IF
IF KEY$ = "n" OR KEY$ = "N" THEN
GOTO NEW.PARTNUMBER
END IF
LOOP WHILE KEY$ < "Y" OR KEY$ > "N"


WRITENEW:
TYPE INFO
PERNAME AS STRING * 10
DT AS STRING * 8
PNAME AS STRING * 35
PRJNAME AS STRING * 12
PRONAME AS STRING * 25
END TYPE

DIM LG AS INFO

OPEN "C:\TEST.DAT" FOR BINARY AS #1
SEEK #1, LOF(1) + 1
PUT #1,, LG
CLOSE#1



Any suggestions or help is greatly appreciated.
Thanks guys.
Logged
casonon
Member
*
Posts: 28


« Reply #26 on: June 06, 2003, 12:36:28 PM »

Glenn.

Ok I guess that I don't understand what you mean by a user-defined type.  Also I am not clear on why you can't have the $.  I thought that the $ allowed the answer to an input to be a entry other then a numeric answer.  Maybe you can give me an example of what I should have inorder to get this to work.  Sorry for being such a dumbass.  But after 6 years of not doing this, you kind of forget ALOT.  :roll:   But I appreciate everyones help.

Thanks
Logged
Glenn
I hold this place together
*****
Posts: 786



WWW
« Reply #27 on: June 06, 2003, 12:47:41 PM »

You 1) left out a "." in a label containing "part.number" (and I don't understand why all of a sudden QB is allowing "." in labels) and you had a "$" on "LG.PERNAME".  And I also had to move your user-defined type structure to the top (before you use variables in it).  The variable type you're defining with the TYPE INFO structure is a user-defined type.



TYPE INFO
   PERNAME AS STRING * 10
   DT AS STRING * 8
   PNAME AS STRING * 35
   PRJNAME AS STRING * 12
   PRONAME AS STRING * 25
END TYPE

DIM LG AS INFO
OPTION.PAGE:
CLS
PRINT TAB(25); "IRON MOUNTAIN PART LOG"
PRINT
PRINT "1. OBTAIN NEW PART NUMBER"
PRINT "2. SEARCH PART LOG"
PRINT "3. VIEW ENTIRE PROJECT PART LOG"
DO
   KEY$ = INKEY$
LOOP WHILE KEY$ < "1" OR KEY$ > "4"

SELECT CASE KEY$
   CASE "1"
      GOTO NEW.PART.NUMBER
   CASE "2"
      CLS
      PRINT "2 WORKS"
   CASE "3"
      CLS
      PRINT "3 WORKS"
END SELECT

NEW.PART.NUMBER:
CLS
INPUT "PLEASE ENTER YOUR INITALS"; LG.PERNAME
CLS
PRINT
PRINT "SELECT A PROJECT"
PRINT
PRINT " 1. BEDRAILS"
PRINT " 2. BOUNCERS"
PRINT " 3. CARSEATS"
PRINT " 4. HIGH CHAIRS"
PRINT " 5. HOOK ON CHAIRS"
PRINT " 6. JUMPERS"
PRINT " 7. PNP"
PRINT " 8. STROLLERS"
PRINT " 9. WALKERS AND ENTERTAINERS"
DO
   KEY$ = INKEY$
LOOP WHILE KEY$ < "1" OR KEY$ > "9"

SELECT CASE KEY$
   CASE "1"
      LG.PRJNAME$ = "BEDRAILS"
   CASE "2"
      LG.PRJNAME$ = "BOUNCERS"
   CASE "3"
      LG.PRJNAME$ = "CARSEATS"
   CASE "4"
      LG.PRJNAME$ = "HIGH CHAIRS"
   CASE "5"
      LG.PRJNAME$ = "HOOK ON CHAIRS"
   CASE "6"
      LG.PRJNAME$ = "JUMPERS"
   CASE "7"
      LG.PRJNAME$ = "PLAY YARDS"
   CASE "8"
      LG.PRJNAME$ = "STROLLERS"
   CASE "9"
      LG.PRJNAME$ = "WALKERS & ENTERTAINERS"
END SELECT

CLS
INPUT "ENTER THE TITLE OF THE PROJECT"; LG.PRONAME$
CLS
PRINT
PRINT " 1. ENTER YOUR OWN PART NAME"
PRINT " 2. USE NAME WIZARD"
DO
   KEY$ = INKEY$
LOOP WHILE KEY$ < "1" OR KEY$ > "2"

SELECT CASE KEY$
   CASE "1"
      GOTO NAMING
   CASE "2"
      GOTO NAME.WIZARD
END SELECT

NAMING:
CLS
INPUT "ENTER THE NAME FOR YOUR PART"; LG.PNAME$
GOTO NAMEVERIFY

NAME.WIZARD:
CLS
PRINT
PRINT " 1. TUBE"
PRINT " 2. TRAY"
PRINT " 3. HOUSING"
PRINT " 4. WHEEL"
PRINT
INPUT "SELECT A PRIMARY DESCRIPTIVE NAME FOR YOUR PART"; DES.1$
   SELECT CASE DES.1$
      CASE "1"
         NAME.1$ = "TUBE"
         GOTO TUBE.WIZ
      CASE "2"
         NAME.1$ = "TRAY"
         GOTO TRAY.WIZ
      CASE "3"
         NAME.1$ = "HOUSING"
         GOTO HOUS.WIZ
      CASE "4"
         NAME.1$ = "WHEEL"
         GOTO WHEEL.WIZ
      CASE ELSE
         NAME.1$ = DES.1$
         GOTO OWN.WIZ.1
   END SELECT
END

TUBE.WIZ:
CLS
PRINT
PRINT " 1. STROLLER"
PRINT " 2. HIGH CHAIR"
PRINT " 3. SWING"
PRINT " 4. PLAY YARD"
PRINT
INPUT "SELECT A SECONDARY DESCRIPTIVE NAME FOR YOUR PART OR ENTER YOUR OWN"; DES.2$
   SELECT CASE DES.2$
      CASE "1"
         NAME.2$ = "STROLLER"
      CASE "2"
         NAME.2$ = "HIGH CHAIR"
      CASE "3"
         NAME.2$ = "SWING"
      CASE "4"
         NAME.2$ = "PNP"
      CASE ELSE
         NAME.2$ = DES.2$
   END SELECT
CLS
PRINT
PRINT " 1. FRONT LEG"
PRINT " 2. REAR LEG"
PRINT " 3. BASKET TUBE"
PRINT " 4. CROSS TUBE"
PRINT
INPUT "SELECT A LOCATION FOR THE TUBE OR ENTER A DESCRIPTIVE AREA OF YOUR OWN"; DES.3$
   SELECT CASE DES.3$
      CASE "1"
         NAME.3$ = "FRONT LEG"
      CASE "2"
         NAME.3$ = "REAR LEG"
      CASE "3"
         NAME.3$ = "BASKET TUBE"
      CASE "4"
         NAME.3$ = "CROSS TUBE"
      CASE ELSE
         NAME.3$ = DES.3$
   END SELECT
   GOTO NAME.VERIFY.WIZ

TRAY.WIZ:
CLS
PRINT
PRINT " 1. HIGH CHAIR"
PRINT " 2. STROLLER"
PRINT " 3. SWING"
PRINT
INPUT "SELECT A SECONDARY DESCRIPTIVE NAME FOR YOUR PART OR ENTER YOUR OWN"; DES.2$
   SELECT CASE DES.2$
      CASE "1"
         NAME.2$ = "HIGH CHAIR"
      CASE "2"
         NAME.2$ = "STROLLER"
      CASE "3"
         NAME.2$ = "SWING"
      CASE ELSE
         NAME.2$ = DES.2$
   END SELECT
CLS
PRINT
PRINT " 1. PARENT"
PRINT " 2. CHILD"
PRINT " 3. PLAY"
PRINT " 4. TOY"
PRINT
INPUT "SELECT A LOCATION FOR THE TRAY OR ENTER A DESCRIPTIVE AREA OF YOUR OWN"; DES.3$
   SELECT CASE DES.3$
      CASE "1"
         NAME.3$ = "PARENT"
      CASE "2"
         NAME.3$ = "CHILD"
      CASE "3"
         NAME.3$ = "PLAY"
      CASE "4"
         NAME.3$ = "TOY"
      CASE ELSE
         NAME.3$ = DES.3$
   END SELECT
   GOTO NAME.VERIFY.WIZ

HOUS.WIZ:
CLS
PRINT
PRINT " 1. STROLLER"
PRINT " 2. HIGH CHAIR"
PRINT " 3. SWING"
PRINT " 4. PLAY YARD"
PRINT
INPUT "SELECT A SECONDARY DESCRIPTIVE NAME FOR YOUR PART OR ENTER YOUR OWN"; DES.2$
   SELECT CASE DES.2$
      CASE "1"
         NAME.2$ = "STROLLER"
      CASE "2"
         NAME.2$ = "HIGH CHAIR"
      CASE "3"
         NAME.2$ = "SWING"
      CASE "4"
         NAME.2$ = "PNP"
      CASE ELSE
         NAME.2$ = DES.2$
   END SELECT
CLS
PRINT
PRINT " 1. FOLD"
PRINT " 2. SUPPORT"
PRINT " 3. SWIVEL"
PRINT " 4. RECLINE"
PRINT
INPUT "SELECT A LOCATION FOR THE HOUSING OR ENTER A DESCRIPTIVE AREA OF YOUR OWN"; DES.3$
   SELECT CASE DES.3$
      CASE "1"
         NAME.3$ = "FOLD"
      CASE "2"
         NAME.3$ = "SUPPORT"
      CASE "3"
         NAME.3$ = "SWIVEL"
      CASE "4"
         NAME.3$ = "RECLINE"
      CASE ELSE
         NAME.3$ = DES.3$
   END SELECT
   GOTO NAME.VERIFY.WIZ

WHEEL.WIZ:
CLS
PRINT
PRINT " 1. STROLLER"
PRINT " 2. HIGH CHAIR"
PRINT " 3. PLAY YARD"
PRINT
INPUT "SELECT A SECONDARY DESCRIPTIVE NAME FOR YOUR PART OR ENTER YOUR OWN"; DES.2$
   SELECT CASE DES.2$
      CASE "1"
         NAME.2$ = "STROLLER"
      CASE "2"
         NAME.2$ = "HIGH CHAIR"
      CASE "3"
         NAME.2$ = "PLAY YARD"
      CASE ELSE
         NAME.2$ = DES.2$
   END SELECT
CLS
PRINT
PRINT " 1. 6"
PRINT " 2. 7"
PRINT " 3. 8"
PRINT " 4. 8.5"
PRINT
INPUT "SELECT A DIAMETER FOR THE WHEEL OR ENTER A DIAMETER OF YOUR OWN"; DES.3$
   SELECT CASE DES.3$
      CASE "1"
         NAME.3$ = "6"
      CASE "2"
         NAME.3$ = "7"
      CASE "3"
         NAME.3$ = "8"
      CASE "4"
         NAME.3$ = "8.5"
      CASE ELSE
         NAME.3$ = DES.3$
   END SELECT
   GOTO NAME.VERIFY.WIZ

OWN.WIZ.1:
CLS
PRINT
PRINT " 1. BEDRAILS"
PRINT " 2. BOUNCERS"
PRINT " 3. CARSEATS"
PRINT " 4. HIGH CHAIRS"
PRINT " 5. HOOK ON CHAIRS"
PRINT " 6. JUMPERS"
PRINT " 7. PNP"
PRINT " 8. STROLLERS"
PRINT " 9. WALKERS AND ENTERTAINERS"
PRINT
INPUT "SELECT A SECONDARY DESCRIPTIVE NAME FOR YOUR PART OR ENTER YOUR OWN"; DES.2$
   SELECT CASE DES.2$
      CASE "1"
         NAME.2$ = "BEDRAIL"
      CASE "2"
         NAME.2$ = "BOUNCER"
      CASE "3"
         NAME.2$ = "CARSEAT"
      CASE "4"
         NAME.2$ = "HIGH CHAIR"
      CASE "5"
         NAME.2$ = "HOOK ON CHAIR"
      CASE "6"
         NAME.2$ = "JUMPER"
      CASE "7"
         NAME.2$ = "PLAY YARD"
      CASE "8"
         NAME.2$ = "STROLLER"
      CASE "9"
         NAME.2$ = "WALKER - ENTERTAINER"
      CASE ELSE
         NAME.2$ = DES.2$
   END SELECT
CLS
INPUT "ENTER A LOCATION FOR THE PART"; DES.3$
   NAME.3$ = DES.3$
   GOTO NAME.VERIFY.WIZ

NAME.VERIFY.WIZ:
S$ = "-"
CLS
PRINT
PRINT "NEW PART NAME : "; NAME.1$; "-"; NAME.2$; "-"; NAME.3$
PRINT
PRINT "IS THIS INFORMATION CORRECT (y/n)"
DO
   KEY$ = INKEY$
   IF KEY$ = "y" OR KEY$ = "Y" THEN
      LG.PNAME$ = NAME.1$ + S$ + NAME.2$ + S$ + NAME.3$
      GOTO NAMEVERIFY
   END IF
   IF KEY$ = "n" OR KEY$ = "N" THEN
      GOTO NAME.WIZARD
   END IF
LOOP WHILE KEY$ < "Y" OR KEY$ > "N"

NAMEVERIFY:
LG.DT$ = DATE$
CLS
PRINT "NAME : "; LG.PERNAME
PRINT
PRINT "DATE : "; LG.DT$
PRINT
PRINT "PART NAME : "; LG.PNAME$
PRINT
PRINT "PROJECT : "; LG.PRJNAME$
PRINT
PRINT "PROJECT TITLE : "; LG.PRONAME$
PRINT
PRINT "IS THIS INFORMATION CORRECT (y/n)"
DO
   KEY$ = INKEY$
   IF KEY$ = "y" OR KEY$ = "Y" THEN
      GOTO WRITENEW
   END IF
   IF KEY$ = "n" OR KEY$ = "N" THEN
      GOTO NEW.PART.NUMBER
   END IF
LOOP WHILE KEY$ < "Y" OR KEY$ > "N"


WRITENEW:

OPEN "C:\TEST.DAT" FOR BINARY AS #1
   SEEK #1, LOF(1) + 1
   PUT #1,, LG
CLOSE#1
Logged

ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
casonon
Member
*
Posts: 28


« Reply #28 on: June 06, 2003, 12:57:42 PM »

THANK YOU....
I got it to do part of what I wanted.  Now this weekend I need to see if I can get it to search the file.  I REALLY appreciate all the help.
I am sure I will have more questions.

Chris
Logged
Glenn
I hold this place together
*****
Posts: 786



WWW
« Reply #29 on: June 06, 2003, 02:09:32 PM »

Incidentally, instead of

SEEK #1, LOF(1) + 1
PUT #1,, LG

You can just do

PUT#1, LOF(1) +1, LG

Or if you're writing data sequentially, beginning at the beginning of the file, you can just do

PUT#1,, LG

and forget SEEK or explicitly specifying where to write to altogether.  (PUT# and GET# always by default start at the beginning of the file and then move the file pointer to the byte position after the data written or read.)
Logged

ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Pages: 1 [2] 3
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!