本文整理汇总了C++中NarrowString::SetASCII方法的典型用法代码示例。如果您正苦于以下问题:C++ NarrowString::SetASCII方法的具体用法?C++ NarrowString::SetASCII怎么用?C++ NarrowString::SetASCII使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NarrowString
的用法示例。
在下文中一共展示了NarrowString::SetASCII方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendRequest
bool
LiveTrack24::StartTracking(SessionID session, const TCHAR *username,
const TCHAR *password, unsigned tracking_interval,
VehicleType vtype, const TCHAR *vname,
OperationEnvironment &env)
{
// http://www.livetrack24.com/track.php?leolive=2&sid=42664778&pid=1&
// client=YourProgramName&v=1&user=yourusername&pass=yourpass&
// phone=Nokia 2600c&gps=BT GPS&trk1=4&vtype=16388&
// vname=vehicle name and model
const WideToUTF8Converter username2(username);
const WideToUTF8Converter password2(password);
const WideToUTF8Converter vname2(vname);
if (!username2.IsValid() || !password2.IsValid() || !vname2.IsValid())
return false;
#ifdef _UNICODE
NarrowString<32> version;
version.SetASCII(XCSoar_VersionLong);
#else
const char *version = XCSoar_VersionLong;
#endif
NarrowString<2048> url;
url.Format("http://%s/track.php?leolive=2&sid=%u&pid=%u&"
"client=%s&v=%s&user=%s&pass=%s&vtype=%u&vname=%s",
GetServer(), session, 1, "XCSoar", version,
(const char *)username2, (const char *)password, vtype, vname);
return SendRequest(url, env);
}
示例2: CleanString
/**
* Clean a string and write it to the Port.
*/
static bool
WriteCleanString(Port &port, const TCHAR *p,
OperationEnvironment &env, unsigned timeout_ms)
{
NarrowString<256> buffer;
buffer.SetASCII(p);
CleanString(buffer.buffer());
return port.FullWriteString(buffer, env, timeout_ms);
}