are the argv[] strings in read-only memory? Maybe you need to copy the string to a temp buffer and use strtok on that temp buffer.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
>are the argv[] strings in read-only memory?
No, they're required to be writable.
>I have traced it down to the "$" character on the command line.
Can you paste your debug trace here?
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
What does tibrvMsg_UpdateString do? Is it a library or a function you've written? Also, what are subjectName, status, and message defined as? It would be nice if you could set up the smallest possible test program (that we can compile and run without adding any framework) that exhibits the error and cuts out anything unnecessary.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>>Solaris I get a fault. I have traced it down to the "$" character on the command line.
does Solaris shell interpret that $ symbol (is it a special character like '>' and '<')? try putting it in quotes
_VARIABLE=SRC_SERVICE.IDN.me _HOST=chtsapdbu3 "$TYPE=CHI_PRD"
or if that doesn't work, can you escape it?
_VARIABLE=SRC_SERVICE.IDN.me _HOST=chtsapdbu3 \$TYPE=CHI_PRD
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
I meant to escepe it on the command-line so that the shell does not interpret it. If you have no control over that, then escaping it is not an option. Doing it after it reaches your program argv[] will do nothing more than put the liberal '\' in argv[] string.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
if all you want to do is change the $ to _, you can just change argv[] and not copy to another buffer (see Narue's earlier comment).
for(i = 1; i < argc; i++)
{
char* p = strchr(argv[i],'$'); // find the $ symbol
if(p != 0)
*p = '_';
}
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343