Announcement

Collapse
No announcement yet.

Hi, I am new here

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hi, I am new here

    Hey there,

    I am a Newby and I got a problem.

    I wrote this little program :

    start:
    while text$="" : text$=inkey$ : wend
    if text$=chr$(13) then goto ende
    print text$;
    text$=""
    goto start

    ende:
    print "You wrote : ", text$
    end

    My problem is that I'd like to write and print out a whole sentence into
    the variable text$. But all the variable continues is a strange symbol.
    How can I save more than one symbol into the variable text$? By the way I am
    using PB/DOS 2.10f .

    Thanks for your help. I hope my English is good enough to make clear what I want.

    Greets
    Chris


    ------------------
    Christian Damhus M.A.

  • #2
    Try this

    while a$=""
    a$=inkey$
    if a$<>chr$(13) then test$=test$+a$
    if a$=chr$(13) goto exitloop
    wend
    exitloop:
    print test$
    end

    ------------------

    Comment


    • #3
      Disregarding "proper coding methods" I have modified your code
      to reflect what I think you are asking...

      Code:
      start:
      	while PressedKey$="" : PressedKey$=inkey$ : wend
      	if PressedKey$=chr$(13) then goto ende
      	print PressedKey$;
      	text$=text$ & PressedKey$
      	PressedKey$ = ""
      	goto start
      
      ende:
      	print "You wrote : ", text$
      	end
      ------------------
      Every day I try to learn one thing new,
      but new things to learn are increasing exponentially.
      At this rate I’m becoming an idiot faster and faster !!!
      ------------------
      George W. Bleck
      Lead Computer Systems Engineer
      KeySpan Corporation
      My Email

      [This message has been edited by George Bleck (edited November 23, 2003).]
      <b>George W. Bleck</b>
      <img src='http://www.blecktech.com/myemail.gif'>

      Comment


      • #4
        Sorry I screwed up on that one, try this one instead.
        Never write code while playing counter strike.

        start:
        while a$="": a$=inkey$: wend
        if a$=chr$(13) then continue
        test$=test$+a$
        goto start
        continue:

        ------------------

        Comment


        • #5
          Been a while since I used DOS, but why not do it like this...

          Code:
            line input a$
            print "You entered: " a$
          ------------------
          Kev Peel
          http://www.kgpsoftware.com
          kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

          Comment


          • #6
            Originally posted by Kev Peel:
            ...but why not do it like this...
            Line input will work but maybe he needs his program to do other
            processing between key strokes.


            ------------------
            There are no atheists in a fox hole or the morning of a math test.
            If my flag offends you, I'll help you pack.

            Comment


            • #7
              Hi Christian & welcome.

              As you can see there are more many ways to do the same thing.
              Don't be discouraged by all the different answers it's just a
              thing programmers have been doing since day 1.

              You pick the one you like and then THAT one becomes the right one!

              Code:
              start:
                c$ = ""
                do
                  c$ = inkey$
                loop until len(c$) > 0
                if c$ = chr$(13) then goto ende
                Text$ = Text$ + C$
                locate 1, 1 
                print text$;
              goto start
              
              ende:
                locate 1, 2
                print "You wrote : ", text$
              end
              ------------------
              C'ya
              Don
              [email protected]
              C'ya
              Don

              http://www.ImagesBy.me

              Comment


              • #8
                Hey there,

                thanks for your support. Don's version is working perfectly.

                Btw : Would you suggest to upgrade to PB/DOS 3.5 or should I better
                purchase PB/CC ? I heard it's easier for a dos programmer (and
                bloody beginner like me) to start with PB/CC instead to start
                with PB/Win. Is that true?

                Greets
                Chris

                ------------------
                Christian Damhus M.A.

                Comment


                • #9
                  Hi Christian, and welcome!

                  Would you suggest to upgrade to PB/DOS 3.5 or should I better purchase PB/CC ?
                  IMO it mainly depends on whether you want your console-mode programs to run under Windows on under DOS.
                  If you want them to run under Windows, you better go for PB/CC which allows you to use a lot of Windows features and integrates a whole lot better with Windows.
                  About PB/DOS, if you upgrade to PB/DOS 3.5 you'll get many more powerful features than PB/DOS 2 and you will be able to write very powerful DOS programs, but under Windows they'll need to run in a DOS box.

                  I heard it's easier for a dos programmer (and bloody beginner like me) to start with PB/CC instead to start with PB/Win. Is that true?
                  IMO it's certainly true because with PB/Win you need to learn some Windows GUI programming, which a DOS programmer doesn't necessarily already know. Of course you wouldn't do much GUI programming with PB/CC, so if your goal is learning Windows GUI programming maybe you'd better go for PB/Win.

                  ------------------
                  Davide Vecchi
                  [email protected]

                  Comment


                  • #10
                    Hi Davide,

                    thanks for your answer. I just ordered PB/WIN. It's the best choice.
                    If it's too difficult for me, I can still go back to PB/DOS...

                    Greets
                    Chris


                    ------------------
                    Christian Damhus M.A.

                    Comment


                    • #11
                      Of course!!!!

                      Originally posted by Christian Damhus:
                      Hey there,

                      thanks for your support. Don's version is working perfectly.



                      ------------------
                      C'ya
                      Don
                      [email protected]
                      C'ya
                      Don

                      http://www.ImagesBy.me

                      Comment

                      Working...
                      X