When you run the program, what are you seeing as output? Are you getting any errors? You didn’t happen to name your test.c program ‘test’ did you? If you did, it won’t run becuase there is a built in shell command called test that would be executed instead. This bites a lot of people if that’s the case, rename your executable.
In the ds_create() call you pass in the string test as the 2nd argument. However it doesn’t have any value set in your program. If you mean to set it to “test” you need a sprintf(test, “test”); line before ds_create().
I have named my program dsscript.c and i am compiling it using qcc dsscript.c -lds which creates an output file a.out I then just type a.out and it executes the program and I see the output as junk characters . The test_val variable is printed correctly. So i know that the sprintf variable is working fine… but i think the problem is with ds_set cos the value in test_val is not getting populated correctly in the test variable.
1
Test:è)3°ÿÿÿÿè)3°è)3°*
2
Test:è)3°ÿÿÿÿè)3°è)3°*
3
Test:è)3°ÿÿÿÿè)3°è)3°*
4
Test:è)3°ÿÿÿÿè)3°è)3°*
5
Test:è)3°ÿÿÿÿè)3°è)3°*
End of loop
In ds_create() i am just trying to create a ds variable named test to which i set the value equal to test_val in the ds_set command.
Is it necessary to assign a value to a variable before ds_create?
As Tim mentioned the problem is not with test_val it’s with test, which should be the name of the variable. You are not initializing it, hence it’s garbage…
No… the ds_set function is correct and the output that i get is also correct. I just needed to check the value of the variable from an html page. When I did that, i got the incremented values
Let me see, you are using ds_set properly but it`s not working, then the problem must be the QNX program ds. In that case contact QNX to get official support, maybe you can get the source to ds and fix it.
The only explanation I can see is that ds must take the variable string convert it to an integer, add one to it then convert it back to a string…