APN.C :从误差响应中提取标识符
APNS. C++: extract Identifier from error responce
我有一个C 应用程序,该应用程序发送Apple Push Notifications
它使用增强的通知格式https://developer.com/library/ios/documentation/networkinginternet/conceptual/remotenotificationpg/chapterpg/chapterspg/chapters/legacyformat.htmll#/plefformat.htmll#//p>
有时我会收到错误,并想正确解析
这是错误响应格式的解释:https://deverveer..apple.com/library/ios/documentation/networkinginternet/conepperual/coneptual/remotenotificationationpg/chapters/communicatingwithaps.html#//communicatingwithaps.html#//apple/apple_re_reff/doc/redoc/doc/uid/uid/uid/tp40008194-194-194-ch101-s101-sw4
我们有1个字节命令,1个字节状态和4个字节标识符。我的标识符提取
有问题这是我的代码如何提取命令和状态
char data[6];
...
int Command = data[0];
int Status = data[1];
int Identifier = ...;
请帮助我使用标识符
如果您的问题是在四个字节中进行整数,则可以使用:
来完成。char data[6];
...
int Command = data[0];
int Status = data[1];
int Identifier = (data[2] << 24)
| (data[3] << 16)
| (data[4] << 8)
| data[5];
这将标识符视为大型居民,但是由于文档说ID是不透明的,因此您应该可以,如果您在整个应用程序中都将ID视为大型endian。
该文档还提到了字节,而不是字符,因此您的变量也许都应该被签名?
- 从包含m行的文件中提取n行,必要时(惰性地)重复该文件
- 在C++中,是否可以基于给定的标识符创建基类的新实例,反之亦然
- 如何从 std::atomic 中提取指针 T<T>?
- 为什么istream不支持右值提取
- #ifdef和未声明的标识符
- 如何设置一个范围来提取我想要获得的信息
- f2、f3、f4标识符未找到
- 视觉工作室项目.提取源文件夹名称
- 设置 Visual Studio for MPI: 找不到标识符错误
- 未声明的标识符编译暗黑破坏神 2 程序"muleview"
- 在顶点着色器中使用 OpenGl 的未声明标识符,我在顶点着色器中绘制三角形时遇到问题
- C++17 - 使用自定义分配器的节点提取/重新插入 - 适用于 clang++/libc++,但不适用于 libstd
- Google protobuf 时间戳未声明标识符,在 Windows 上具有C++
- 如何让 GCC/Clang 在保留标识符上出错
- 从字符串中提取整数并形成一个数组
- 错误 C2760:语法错误:映射迭代器上意外的标记"标识符",预期的";"
- 当简单捕获中的标识符显示为参数的声明符 ID 时,没有编译器诊断
- C ++中的StringStream有助于使用向量从字符串中提取逗号分隔的整数,而不是空格分隔的整数,为什么?
- asn1c 不会从 asn.1 模块中提取八位字节字符串的默认值
- APN.C :从误差响应中提取标识符