|
Post by mesut2513 on Feb 22, 2008 7:28:32 GMT
qbasic
field get put
please easy sample.....?
|
|
|
Post by Mikrondel on Feb 24, 2008 1:28:53 GMT
QB help has many examples. What are you trying to achieve?
The FIELD statement is not needed very often. Do you really need to use it?
GET and PUT can be used in many ways. Please give more information about what you are trying to do.
|
|
|
Post by schooll homework on Feb 24, 2008 6:12:14 GMT
|
|
|
Post by Mikrondel on Feb 26, 2008 7:35:55 GMT
It is difficult to explain for me, if you have trouble understanding English, but I will try.
GET is used to load data from a file, into a variable. PUT is used to save a variable to a file. This variable can be a TYPE variable (many variables together).
GET #x, y, z
will read into z, from file number x, starting from position y. Without y, it will continue reading from the current position. PUT is the same except writes z to the file.
FIELD is used to "look" at the data in the file. If you use FIELD many times, you will be able to "look" in different ways.
This is from QuickBasic 7.1 help:
'This example uses the FIELD statement to define a random-access file buffer. 'In the first FIELD statement, the 67-byte buffer is broken up into five 'separate variables for name, address, city, state, and zip code. In the 'second FIELD statement, the same buffer is assigned entirely to one 'variable, Plist$. The program then checks to see if Zip$, which contains 'the zip code, falls within a certain range; if it does, the complete 'address string is printed.
TYPE Buffer FuName AS STRING * 25 Addr AS STRING * 25 City AS STRING * 10 State AS STRING * 2 Zip AS STRING * 5 END TYPE DIM RecBuffer AS Buffer
'Note: This part of the program creates a random-access file for use by the 'second part of the program, which demonstrates the FIELD statement.
OPEN "MAILLIST.DAT" FOR RANDOM AS #1 LEN = LEN(RecBuffer) CLS RESTORE READ FuName$, Addr$, City$, State$, Zip$ I = 0 DO WHILE UCASE$(FuName$) <> "END" I = I + 1 RecBuffer.FuName = FuName$ RecBuffer.Addr = Addr$ RecBuffer.City = City$ RecBuffer.State = State$ RecBuffer.Zip = Zip$ PUT #1, I, RecBuffer READ FuName$, Addr$, City$, State$, Zip$ IF FuName$ = "END" THEN EXIT DO LOOP CLOSE #1
DATA "Bob Hartzell","1200 Liberty St.","Bow","WA","98232" DATA "Alice Provan","123 B St.","Bellevue","WA","98005" DATA "Alex Landow","14900 123rd","Bothell","WA","98011" DATA "Walt Riley","33 Minnow Lake Road","Lyman","WA","98263" DATA "Georgette Gump","400 15th W.","Bellevue","WA","98007" DATA "END",0,0,0,0,0
'This part of the program demonstrates use of the FIELD statement.
'Define field and record lengths with constants. CONST FU = 25, AD = 25, CT = 10, ST = 2, ZP = 5 CONST RECLEN = FU + AD + CT + ST + ZP
OPEN "MAILLIST.DAT" FOR RANDOM AS #1 LEN = RECLEN FIELD #1, FU AS FuName$, AD AS Addr$, CT AS City$, ST AS State$, ZP AS Zip$ FIELD #1, RECLEN AS Plist$
GET #1, 1 'Read the file, looking for zip codes in the range 98000 to 98015. DO WHILE NOT EOF(1) Zcheck$ = Zip$ IF (Zcheck$ >= "98000" AND Zcheck$ <= "98015") THEN Info$ = Plist$ PRINT LEFT$(Info$, 25) PRINT MID$(Info$, 26, 25) PRINT RIGHT$(Info$, 17) PRINT END IF GET #1 LOOP CLOSE #1
|
|
|
Post by ajjj on Sept 26, 2015 9:26:44 GMT
how can i download q basic
|
|
no rply to my questions
Guest
|
Post by no rply to my questions on Sept 26, 2015 9:28:09 GMT
no rply to my questions
|
|