User forums > Using Code::Blocks

Unable to use %RANDOM% in Project->Set programs' arguments

(1/2) > >>

Morwenn:
One of my projects has a test suite that uses the testing framework Catch. Catch has a command line option --rng-seed to seed the random number generator, and I want to use it with a random seed. In order to achieve that I tried to run the compiled test suite project as follows (Windows 10):


--- Code: ---testsuite.exe --rng-seed %RANDOM%
--- End code ---

Seeing that it worked fine, I decided to pass the same parameter directly to my Code::Blocks project through "Project->Set programs' arguments". However, when I give the command-line parameter --rng-seed %RANDOM% to Code::Blocks, the command line parser actually receives the string %RANDOM% instead of the corresponding integer. Is there a way to circumvent this problem and have Code::Blocks evaluate %RANDOM% instead of passing it as a string?

oBFusCATed:
What is %RANDOM%? Environment variable? Some batch built-in function?
Does it work if you use start in the cmd to execute the command?

Morwenn:
It's the rough equivalent of Unix $RANDOM: it's an environment variable automatically replaced by a random integer.
It does work if I start the cmd to execute the command.

oBFusCATed:
Can you try with this one: http://wiki.codeblocks.org/index.php/Variable_expansion#Random_values ?

Morwenn:
I just tried with the four different variable syntaxes described in the linked page, but none worked.

Navigation

[0] Message Index

[#] Next page

Go to full version