蓝桉丿丶 2022-10-26 21:42 采纳率: 100%
浏览 190
已结题

keilC251不能使用strstr函数怎么解决

keil不能使用strstr函数怎么办?
函数定义:

char *strx;
char MLSBUF[100];

出问题的代码:

strx = strstr((const char*)MLSBUF,(const char*)"OK");

引用的头文件:

#include "string.h"
#include "stdio.h"

具体问题:

img

查阅相关资料说是没有找到strstr函数的定义,然后我到string.h里面看了看,发现的确没有strstr函数定义,该怎么解决啊
string.h:

/*--------------------------------------------------------------------------
STRING.H

String functions for C251 Version 4.
Copyright (c) 1995-2007 Keil Elektronik GmbH and Keil Software, Inc.
All rights reserved.
--------------------------------------------------------------------------*/

#pragma SAVE
#pragma PARM251

#ifndef _SIZE_T
 #define _SIZE_T
 typedef unsigned int size_t;
#endif

#ifndef NULL
 #define NULL ((void *) 0L)
#endif

#if (__C251__ >= 200) 
extern char *strcat (char *s1, const char *s2) reentrant;
extern char *strncat (char *s1, const char *s2, size_t n) reentrant;

extern char strcmp (const char *s1, const char *s2) reentrant;
extern char strncmp (const char *s1, const char *s2, size_t n) reentrant;

extern char *strcpy (char *s1, const char *s2) reentrant;
extern char *strncpy (char *s1, const char *s2, size_t n) reentrant;

extern size_t strlen (const char *) reentrant;

extern char *strchr (const char *s, char c) reentrant;
extern int strpos (const char *s, char c) reentrant;
extern char *strrchr (const char *s, char c) reentrant;
extern int strrpos (const char *s, char c) reentrant;

extern size_t strspn (const char *s, const char *set) reentrant;
extern size_t strcspn (const char *s, const char *set) reentrant;
extern char *strpbrk (const char *s, const char *set) reentrant;
extern char *strrpbrk (const char *s, const char *set) reentrant;

extern char memcmp (const void *s1, const void *s2, size_t n) reentrant;
extern void *memcpy (void *s1, const void *s2, size_t n) reentrant;
extern void *memchr (const void *s, char val, size_t n) reentrant;
extern void *memccpy (void *s1, const void *s2, char val, size_t n) reentrant;
extern void *memmove (void *s1, const void *s2, size_t n) reentrant;
extern void *memset  (void *s, char val, size_t n) reentrant;

extern void far   *fmemset  (void far *s,   char val, unsigned int n) reentrant;
extern void xdata *xmemset  (void xdata *s, char val, unsigned int n) reentrant;
extern void far   *fmemcpy  (void far *s1,  void far *s2, unsigned int n) reentrant;
extern void xdata *xmemcpy  (void xdata *s1, void xdata *s2, unsigned int n) reentrant;

extern unsigned long hstrlen (const char huge *s)  reentrant;
extern          char hstrcmp (const char huge *s1, const char huge *s2)  reentrant;
extern    char huge *hstrcpy (char huge *s1, const char huge *s2)  reentrant;

#pragma PARM4  // allow a maximum of 4 long as register parameters
extern char huge *hstrncpy (char huge *s1, const char huge *s2, unsigned long n) reentrant; 

extern      char  hmemcmp (const void huge *s1, const void huge *s2, unsigned long len) reentrant;
extern void huge *hmemcpy (void huge *s1, const void huge *s2, unsigned long len) reentrant;
extern void huge *hmemchr (const void huge *ptr, char val, unsigned long len) reentrant;
extern char huge *hmemccpy (char huge *dest, const char huge *src, char val, unsigned long len) reentrant;
extern void huge *hmemmove (void huge *s1, const void huge *s2, unsigned long len) reentrant;
extern void huge *hmemset (void huge *ptr, char val, unsigned long len) reentrant;

#else
extern char *strcat (char *s1, char *s2);
extern char *strncat (char *s1, char *s2, int n);

extern char strcmp (char *s1, char *s2);
extern char strncmp (char *s1, char *s2, int n);

extern char *strcpy (char *s1, char *s2);
extern char *strncpy (char *s1, char *s2, int n);

extern int strlen (char *);

extern char *strchr (const char *s, char c);
extern int strpos (const char *s, char c);
extern char *strrchr (const char *s, char c);
extern int strrpos (const char *s, char c);

extern int strspn (char *s, char *set);
extern int strcspn (char *s, char *set);
extern char *strpbrk (char *s, char *set);
extern char *strrpbrk (char *s, char *set);

extern char memcmp (void *s1, void *s2, int n);
extern void *memcpy (void *s1, void *s2, int n);
extern void *memchr (void *s, char val, int n);
extern void *memccpy (void *s1, void *s2, char val, int n);
extern void *memmove (void *s1, void *s2, int n);
extern void *memset  (void *s, char val, int n);


#endif

#pragma RESTORE
  • 写回答

1条回答 默认 最新

  • qq_41851997 2022-10-27 09:24
    关注

    找strstr源码复制进去代码里面,或者自己写一个

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 11月4日
  • 已采纳回答 10月27日
  • 创建了问题 10月26日

悬赏问题

  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因