首页 \ 问答 \ APP是什么意思?

APP是什么意思?

现在企业的微信和APP的营销很流行,想了解下相关APP的。
更新时间:2022-07-02 17:07

最满意答案

strtok函数会修改s的内容的。
而你的s是一个指针,指向的地址很有可能是一个常量,或者禁止修改的字符串(比如:命令行参数)。
你可以复制一个s,用复制后的s进行分割。

char s1[100];
strcpy(s1, s);

char *t = strtok(s1,",");

while(t!=NULL)

{
    printf("%s\n", t);

t=strtok(NULL,",");

}

其他回答

原型
  char *strtok(char *s, char *delim);
编辑本段功能
  分解字符串为一组字符串。s为要分解的字符串,delim为分隔符字符串。
编辑本段说明
  首次调用时,s指向要分解的字符串,之后再次调用要把s设成null。   strtok在s中查找包含在delim中的字符并用null('')来替换,直到找遍整个字符串。   char * p = strtok(s,";");   p = strtok(null,";");   在调用的过程中,字串s被改变了,这点是要注意的。
编辑本段返回值
  从s开头开始的一个个被分割的串。当没有被分割的串时则返回null。   所有delim中包含的字符都会被滤掉,并将被滤掉的地方设为一处分割的节点。

相关问答

更多
  • strtok函数会修改s的内容的。 而你的s是一个指针,指向的地址很有可能是一个常量,或者禁止修改的字符串(比如:命令行参数)。 你可以复制一个s,用复制后的s进行分割。 char s1[100]; strcpy(s1, s); char *t = strtok(s1,","); while(t!=NULL) { printf("%s\n", t); t=strtok(NULL,","); }
  • strtok相当于(通常定义为): char *strtok(char *str, const char *delim) { static char *save; return strtok_r(str, delim, &save); } 一般来说,你应该直接使用strtok_r而不是strtok ,除非你需要将你的代码移植到只支持strtok POSIX-2001系统之前 strtok is equivalent to (and often defined as): char *strt ...
  • 如参考所述 ,只需查看标记化元素,如果您遵循它,您就会采用干净的方法。 正确的代码: char buffer[] = "SIZE"; char * tok; tok = strtok(buffer, " "); while(tok != NULL) { if(strcmp(tok, "SIZE") != 0) break; tok = strtok(NULL, " "); // <----Faulted here } 是的,它可能会跳过缓冲区中的多个“SIZE”字 ...
  • 您正在使用output作为char * in while (output != NULL){ 和 output = strtok(NULL, " "); 但output被声明为简单的char char* words, output; 看一看C-FAQ的问题1.5 You are using output as a char * in while (output != NULL){ and output = strtok(NULL, " "); But output is declared as s ...
  • strtok修改原始字符串。 然后你传递一个你无法修改的字符串文字。 您应该声明并初始化cmd如下所示 - char cmd[] = "zwr ^A(\"A\")"; //string: zwr ^A("A") 另外在函数int checkUserRole(char *cmd) - char fileContent[1000000]; // maybe use a pointer instead and allocate memory on heap strtok modifies the ori ...
  • 是的,这是可能的,但有问题: Generic strtok不是可重入的,即它存储有关它在静态位置执行的操作的信息,这意味着您无法在使用一个分隔符进行strtok'ing主字符串和使用另一个分隔符进行提取的子字符串之间跳转。 您需要在主要字符串中完全运行strtok ,然后攻击提取的子字符串。 或者,如果您有一个较新的strtok_r库例程,则_r表示此例程是可重入的,您可以设置一个实例来处理主字符串,并让另一个实例处理提取的子字符串,并在两者之间跳转。 strtok_r采用了一个额外的参数,它保存了它正在做 ...
  • strtok将修改它传递的缓冲区; 这是契约性的 : 使用这些功能时要小心。 如果您确实使用它们,请注意: *这些函数修改他们的第一个参数。 *这些函数不能用于常量字符串。 当你将字符串声明为char *str = "blah blah"; 在C中,你声明它是只读存储器,所以当你将它传递给strtok ,结果是未定义的,因为strtok想要修改缓冲区,但不能,因为它是只读的。 为了解决这个问题,将str声明为一个数组: char str[] = "blah blah"; strtok will modify ...
  • 问题是你使用fgets() 。 它没有返回你认为它第二次做的事情。 第一次通过, fgets()用"10/23/2014\0"填充line[] ,一切都很好。 但是,第二次通过时, ENTER键仍然在stdin的输入缓冲区中,因为第一个fgets() line[]没有任何空间来读取它,所以第二次fgets()用"\n\0"填充line[] "\n\0"无需等待新的用户输入。 第一次调用strtok(line, "/")因此返回"\n" ( atoi()转换为0),然后下一次调用strtok(NULL, "/ ...
  • while (command1 != NULL) 几乎肯定不是你想要做的 - command1 永远不会是NULL /零,因为它在堆栈上。 我认为你的循环会更好地写成: int i = 0; command1[i] = strtok (firstAns, " "); while (command1[i] != NULL) command1[++i] = strtok (NULL, " "); 这将检查正确的项目(最近的strtok的返回值)并将i保留为存储的单词数。 我也考虑让它更 ...
  • 我的编译器对你的程序的结果: Split "UMBR_Donostia_1_2" UMBR Valor ch Salida: Donostia Valor ch Salida: 1 Valor ch Salida: 2 Valor ch Salida: (null) 显然,您将空值传递给它。 [UPD1] #include #include #define MAX_PARAM 80 int dataCommand(char command[], char *d ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)