Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Difficulty with Loops...

filosonicfilosonic Member Posts: 4
what I want to do is during the loop process save all data entered into an outgoing file using the APPEND attribute; but every
time I do this when I view the .dat file then all I get is "0"="JohnDoe" several times; apparantly it only saves the last entry to the file.

also; I would like to change the entry of extra user data to a line input function (or something similar) so I can enter several lines of info;
if possible more than the normal 255characters allowed for the line input function.

and finally; I need a way where I can open the file for input (open "c:user.dat" for input as #1??) and loop the input so all the entered information
is displayed. ......

Here is the source code that I am working on... PLEASE HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
(btw I use QB4.5 with Compilers)

main: cls

input "How many users?", total.loops

if total.loops = 0 then
? "Invalid Entry!"
do: loop until inkey$ = ""
goto main
end if
if total.loops > 0 then goto start.loop

start.loop: cls
count.loops = 0

count.loops = count.loops + 1
if count.loops = total.loops then goto exit.loop
if count.loops <> total.loops then
? "Record Number "; count.loops;" of "; total.loops; ""
input "Enter User Name:",$
input "Enter Extra User Data:",$

open "c:user.dat" for append as #1
? #1, "Rec Num:", count.loops
? #1, "User Name:",$
? #1, "User Data:",$
close #1
end if
loop until count.loops = total.loops

exit.loop: cls
? "... bye ..."
do:loop until inkey$ = ""

Sign In or Register to comment.