Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Environment Variables

regularjoeregularjoe Posts: 5Member
I'v got this problem with this procedure that is getting this environment variable value that isn't what it should be, but I didn't write the program, and I don't know how the environment variable had been set. I'm pretty sure it was written with TP 7.0, or BP 7.0. Where can I find the place where the value was set, since there isn't a SetEnv command for BP/TP? Thanks.

Comments

  • zibadianzibadian Posts: 6,349Member
    : I'v got this problem with this procedure that is getting this environment variable value that isn't what it should be, but I didn't write the program, and I don't know how the environment variable had been set. I'm pretty sure it was written with TP 7.0, or BP 7.0. Where can I find the place where the value was set, since there isn't a SetEnv command for BP/TP? Thanks.
    :
    If you have the source code, you can always run it step by step through the part you don't understand and look at the varues in the various Pascal variables. This will give you a clue which variable holds the ennironment variable. Then you can track what happens to this variable.
  • regularjoeregularjoe Posts: 5Member
    : : I'v got this problem with this procedure that is getting this environment variable value that isn't what it should be, but I didn't write the program, and I don't know how the environment variable had been set. I'm pretty sure it was written with TP 7.0, or BP 7.0. Where can I find the place where the value was set, since there isn't a SetEnv command for BP/TP? Thanks.
    : :
    : If you have the source code, you can always run it step by step through the part you don't understand and look at the varues in the various Pascal variables. This will give you a clue which variable holds the ennironment variable. Then you can track what happens to this variable.
    :

    Yeah. I ran through it line by line with the Turbo Debugger. But I couldn't figure out how to place a watch on the environment variable, and all I can see is that at a certain point the procedure runs the GetEnv function, and returns a certain value. No luck on finding out how that environment variable recieved that value. Any suggestions of code to look for? Thanks again.
  • zibadianzibadian Posts: 6,349Member
    : : : I'v got this problem with this procedure that is getting this environment variable value that isn't what it should be, but I didn't write the program, and I don't know how the environment variable had been set. I'm pretty sure it was written with TP 7.0, or BP 7.0. Where can I find the place where the value was set, since there isn't a SetEnv command for BP/TP? Thanks.
    : : :
    : : If you have the source code, you can always run it step by step through the part you don't understand and look at the varues in the various Pascal variables. This will give you a clue which variable holds the ennironment variable. Then you can track what happens to this variable.
    : :
    :
    : Yeah. I ran through it line by line with the Turbo Debugger. But I couldn't figure out how to place a watch on the environment variable, and all I can see is that at a certain point the procedure runs the GetEnv function, and returns a certain value. No luck on finding out how that environment variable recieved that value. Any suggestions of code to look for? Thanks again.
    :
    If you post the code (including stylecodes), I will take a look at it? By the way an enviroment variable is a variable of DOS itself not of a program, so the TD cannot watch that variable. I was referring to the pascal variable, which receives the value.
  • Phat NatPhat Nat Posts: 757Member
    : : : : I'v got this problem with this procedure that is getting this environment variable value that isn't what it should be, but I didn't write the program, and I don't know how the environment variable had been set. I'm pretty sure it was written with TP 7.0, or BP 7.0. Where can I find the place where the value was set, since there isn't a SetEnv command for BP/TP? Thanks.
    : : : :
    : : : If you have the source code, you can always run it step by step through the part you don't understand and look at the varues in the various Pascal variables. This will give you a clue which variable holds the ennironment variable. Then you can track what happens to this variable.
    : : :
    : :
    : : Yeah. I ran through it line by line with the Turbo Debugger. But I couldn't figure out how to place a watch on the environment variable, and all I can see is that at a certain point the procedure runs the GetEnv function, and returns a certain value. No luck on finding out how that environment variable recieved that value. Any suggestions of code to look for? Thanks again.
    : :
    : If you post the code (including stylecodes), I will take a look at it? By the way an enviroment variable is a variable of DOS itself not of a program, so the TD cannot watch that variable. I was referring to the pascal variable, which receives the value.
    :

    DOS environment variables are set through the DOS command [b]SET[/b]. If you want to add/change/delete these in your program :

    [code]
    USES Crt, Dos;
    VAR S : String;

    Begin
    S := 'BLASTER=A220 I5 D1'; { Example for sound blaster settings }
    Exec('COMMAND.COM','/C SET '+S);

    S := 'TEMP=C:TEMP'; { Example for TEMP directory }
    Exec('COMMAND.COM','/C SET '+S);
    End.
    [/code]

    Phat Nat
Sign In or Register to comment.