Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How to cycle through numbers..?  (Read 8170 times)

0 Members and 1 Guest are viewing this topic.

Helpmeh



    Guru

  • Roar.
  • Thanked: 123
    • Yes
    • Yes
  • Computer: Specs
  • Experience: Familiar
  • OS: Windows 8
Re: How to cycle through numbers..?
« Reply #30 on: October 27, 2009, 04:36:17 PM »
If %money% isn't assigned, then wouldn't set %money%=whatever bring an error because there was no variable name?
Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.

Salmon Trout

  • Guest
Re: How to cycle through numbers..?
« Reply #31 on: October 27, 2009, 04:41:02 PM »
I thought that in NT, the receiving end of an anonymous pipe is launched in a separate child process, so any environment changes will not survive, so, BC_Programmer, how did you get the pipe method to work?




billrich

  • Guest
Re: How to cycle through numbers..?
« Reply #32 on: October 27, 2009, 06:35:09 PM »
If %money% isn't assigned, then wouldn't set %money%=whatever bring an error because there was no variable name?

Yes, I agree just the variable and not the contents of variable.  I  got no error messages, just the wrong answer.   I did not use local variables, so the value was many times  from the previous run. Finally I set the variable to zero at the beginning of the run and there after only zero appeared. No value was ever assigned to the variable with the pipe.

Strange:  it looks like it should work.

The pipe in CMD, the command interpreter,   does not work like UNIX and C.


gh0std0g74



    Apprentice

    Thanked: 37
    Re: How to cycle through numbers..?
    « Reply #33 on: October 27, 2009, 06:40:45 PM »
    DOS is suupose to be the easier stuff  :-\
    no, its not. there are programming limitations in DOS (cmd.exe)  that makes it clumsy(if not impossible) to do certain things. eg floating point maths, arrays, ability for error control, date manipulation etc. If you want to learn programming, start with a real programming language

    BC_Programmer


      Mastermind
    • Typing is no substitute for thinking.
    • Thanked: 1140
      • Yes
      • Yes
      • BC-Programming.com
    • Certifications: List
    • Computer: Specs
    • Experience: Beginner
    • OS: Windows 11
    Re: How to cycle through numbers..?
    « Reply #34 on: October 27, 2009, 08:59:42 PM »
    I thought that in NT, the receiving end of an anonymous pipe is launched in a separate child process, so any environment changes will not survive, so, BC_Programmer, how did you get the pipe method to work?





    Hmm, Not sure. Not sure how I had it working either, maybe it just appeared to work; I was messing about with the commandline seeing how I could force the contents of the file to be the stdin of set /p and I figured I do it with more, may as well give piping a shot. No idea how it worked, must have been a fluke and I had set a variable to the same value I was expecting (???). I believe it's true though, that as far as the | is involved each program is given a inherited environment. (it was my understanding that they could inherit a handle to the same environment, and thus change the values within it... but I suppose cmd doesn't do that.

    redirection works, and it's shorter, too.

    What I did probably stems from when I used "ANSWER.com" to perform input queries in Pure DOS; since it was a program using the pipe to force input wasn't really that esoteric. (And of course the fact that the environment block was relatively unchanged for the execution of any number of programs was a big plus).
    I was trying to dereference Null Pointers before it was cool.