Quotes on @@fullsms@@ or @@sms@@

Quotes on @@fullsms@@ or @@sms@@ SearchSearch
Author Message
Mark Ramirez
New member
Username: Sptext

Post Number: 1
Registered: 11-2005
Posted on Saturday, November 26, 2005 - 02:57 am:   

Bryce,
I found this old reply you gave to a previous post in the archives. I have a follow up question:

Below, you mention including quotes around @@fullsms@@ so NowSMS will consider the value of fullsms as one long string instead of separate variables.

My question is: If @@fullsms@@ has a quotation mark in it, it wreaks havoc on my C++ program because the string value of @@fullsms@@ gets cut off in the middle where the quotation mark is. How do we get around this? It seems unreasonable to tell my users they can't use " on their messages. Can NowSMS convert non-standard characters to their UTF-8 codes automatically before I process the parameters?

Thanks very much.
Mark

>> Bryce Norwood - NowSMS Support
>> Board Administrator
>> Username: Bryce
>> Post Number: 4623
>> Registered: 10-2002
>> Posted on Wednesday, June 01, 2005 - 05:29 pm:
>> ----------------------------------------------->> c:\winnt\system32\CMD.exe /c c:\processsms.exe @@SENDER@@ "@@FULLSMS@@"


>> I am also putting @@FULLSMS@@ in quotes, as >> >> this helps command line programs see the SMS >> text as a single command line variable, >> >> >> instead of multiple variables.

Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 5306
Registered: 10-2002
Posted on Friday, December 02, 2005 - 07:12 pm:   

Hi Mark,

I apologise for being so scarce out here lately.

Actually the quotes are not so much for NowSMS' benefit, but for the benefit of the receiving application to see the string as a single parameter instead of multiple parameters.

But you're right, a quote in the message text could cause some confusion.

My advice would be to not use quotes in the command line. And then have your C++ program look for multiple arguments instead of a single argument containing the message text.

A quote character might still cause some confusion. I suspect it would end up getting lost ... not so much as a function of C++, but rather a function of standard C++ command line parsing.

As an alternative to using argc/argv, how about calling the Windows API GetCommandLine() ... that will give you the raw text of the command line being executed, and you could parse that.

-bn