{"id":39092,"date":"2023-10-02T22:24:12","date_gmt":"2023-10-02T14:24:12","guid":{"rendered":"\/\/www.viralrail.com\/?p=39092"},"modified":"2023-10-02T22:24:12","modified_gmt":"2023-10-02T14:24:12","slug":"srhdyzfc","status":"publish","type":"post","link":"\/\/www.viralrail.com\/blog\/39092.html","title":{"rendered":"STM32\u5982\u4f55\u5b9a\u4e49\u5b57\u7b26\u4e32"},"content":{"rendered":"

  STM32\u662f\u4e00\u79cd\u57fa\u4e8e32\u4f4d\u5fae\u63a7\u5236\u5668\u7684\u5904\u7406\u5668\uff0c\u5b83\u53ef\u4ee5\u5904\u7406\u590d\u6742\u7684\u6570\u636e\u5904\u7406\u4efb\u52a1\uff0c\u5e76\u53ef\u4ee5\u8fd0\u884c\u591a\u79cd\u5e94\u7528\u7a0b\u5e8f\u3002\u5728STM32\u4e2d\uff0c\u5b57\u7b26\u4e32\u662f\u4e00\u79cd\u91cd\u8981\u7684\u6570\u636e\u7c7b\u578b\uff0c\u5b83\u7531\u4e00\u7cfb\u5217\u5b57\u7b26\u7ec4\u6210\uff0c\u53ef\u4ee5\u7528\u6765\u5b58\u50a8\u6587\u672c\u4fe1\u606f\u6216\u4f5c\u4e3a\u51fd\u6570\u53c2\u6570\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728STM32\u4e2d\u5b9a\u4e49\u5b57\u7b26\u4e32\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528\u5b57\u7b26\u4e32\u6765\u5b9e\u73b0\u4e00\u4e9b\u5e38\u89c1\u7684\u64cd\u4f5c\u3002<\/p>\n

\u5b9a\u4e49\u5b57\u7b26\u4e32<\/h2>\n

  STM32\u4e2d\u53ef\u4ee5\u4f7f\u7528\u4e24\u79cd\u65b9\u5f0f\u6765\u5b9a\u4e49\u5b57\u7b26\u4e32\uff1a\u4e00\u79cd\u662f\u4f7f\u7528\u5b57\u7b26\u6570\u7ec4\uff0c\u53e6\u4e00\u79cd\u662f\u4f7f\u7528\u5b57\u7b26\u6307\u9488\u3002<\/p>\n

  \u5b57\u7b26\u6570\u7ec4<\/h3>\n

  \u5b57\u7b26\u6570\u7ec4\u662f\u4e00\u79cd\u5e38\u89c1\u7684\u5b57\u7b26\u4e32\u5b9a\u4e49\u65b9\u5f0f\uff0c\u5b83\u53ef\u4ee5\u5c06\u5b57\u7b26\u4e32\u5b58\u50a8\u5728\u5185\u5b58\u4e2d\uff0c\u4ee5\u4fbf\u7a0b\u5e8f\u53ef\u4ee5\u8bbf\u95ee\u5b83\u3002\u5b57\u7b26\u6570\u7ec4\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\u5b9a\u4e49\uff1a<\/p>\n

char str[20] = \"Hello World\"; <\/code><\/pre>\n

  \u8fd9\u91cc\uff0cstr\u662f\u5b57\u7b26\u6570\u7ec4\u53d8\u91cf\u7684\u540d\u79f0\uff0c20\u662f\u5b57\u7b26\u6570\u7ec4\u7684\u5927\u5c0f\uff0c\u4e5f\u5c31\u662f\u5b57\u7b26\u4e32\u7684\u6700\u5927\u957f\u5ea6\uff0c”Hello World”\u662f\u8981\u5b58\u50a8\u5728\u5b57\u7b26\u6570\u7ec4\u4e2d\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n

  \u5b57\u7b26\u6307\u9488<\/h3>\n

  \u5b57\u7b26\u6307\u9488\u662f\u53e6\u4e00\u79cd\u5e38\u89c1\u7684\u5b57\u7b26\u4e32\u5b9a\u4e49\u65b9\u5f0f\uff0c\u5b83\u53ef\u4ee5\u5c06\u5b57\u7b26\u4e32\u5b58\u50a8\u5728\u5185\u5b58\u4e2d\uff0c\u4ee5\u4fbf\u7a0b\u5e8f\u53ef\u4ee5\u8bbf\u95ee\u5b83\u3002\u5b57\u7b26\u6307\u9488\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\u5b9a\u4e49\uff1a<\/p>\n

char *str = \"Hello World\"; <\/code><\/pre>\n

  \u8fd9\u91cc\uff0cstr\u662f\u5b57\u7b26\u6307\u9488\u53d8\u91cf\u7684\u540d\u79f0\uff0c”Hello World”\u662f\u8981\u5b58\u50a8\u5728\u5b57\u7b26\u6307\u9488\u4e2d\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n

\u4f7f\u7528\u5b57\u7b26\u4e32<\/h2>\n

  STM32\u4e2d\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e9b\u51fd\u6570\u6765\u64cd\u4f5c\u5b57\u7b26\u4e32\uff0c\u4ee5\u5b9e\u73b0\u4e00\u4e9b\u5e38\u89c1\u7684\u64cd\u4f5c\u3002<\/p>\n

  strlen()\u51fd\u6570<\/h3>\n

  strlen()\u51fd\u6570\u53ef\u4ee5\u8ba1\u7b97\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\uff0c\u5b83\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\u8c03\u7528\uff1a<\/p>\n

int len = strlen(str); <\/code><\/pre>\n

  \u8fd9\u91cc\uff0cstr\u662f\u5b57\u7b26\u4e32\u7684\u53d8\u91cf\u540d\uff0clen\u662f\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\uff0c\u4e5f\u5c31\u662f\u5b57\u7b26\u4e32\u4e2d\u5b57\u7b26\u7684\u4e2a\u6570\u3002<\/p>\n

  strcpy()\u51fd\u6570<\/h3>\n

  strcpy()\u51fd\u6570\u53ef\u4ee5\u5c06\u5b57\u7b26\u4e32\u4ece\u4e00\u4e2a\u53d8\u91cf\u590d\u5236\u5230\u53e6\u4e00\u4e2a\u53d8\u91cf\uff0c\u5b83\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\u8c03\u7528\uff1a<\/p>\n

strcpy(dst, src); <\/code><\/pre>\n

  \u8fd9\u91cc\uff0cdst\u662f\u76ee\u6807\u5b57\u7b26\u4e32\u53d8\u91cf\u7684\u540d\u79f0\uff0csrc\u662f\u6e90\u5b57\u7b26\u4e32\u53d8\u91cf\u7684\u540d\u79f0\u3002<\/p>\n

  strcat()\u51fd\u6570<\/h3>\n

  strcat()\u51fd\u6570\u53ef\u4ee5\u5c06\u4e00\u4e2a\u5b57\u7b26\u4e32\u9644\u52a0\u5230\u53e6\u4e00\u4e2a\u5b57\u7b26\u4e32\u7684\u672b\u5c3e\uff0c\u5b83\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\u8c03\u7528\uff1a<\/p>\n

strcat(dst, src); <\/code><\/pre>\n

  \u8fd9\u91cc\uff0cdst\u662f\u76ee\u6807\u5b57\u7b26\u4e32\u53d8\u91cf\u7684\u540d\u79f0\uff0csrc\u662f\u6e90\u5b57\u7b26\u4e32\u53d8\u91cf\u7684\u540d\u79f0\u3002<\/p>\n

  strcmp()\u51fd\u6570<\/h3>\n

  strcmp()\u51fd\u6570\u53ef\u4ee5\u6bd4\u8f83\u4e24\u4e2a\u5b57\u7b26\u4e32\uff0c\u5b83\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\u8c03\u7528\uff1a<\/p>\n

int result = strcmp(str1, str2); <\/code><\/pre>\n

  \u8fd9\u91cc\uff0cstr1\u548cstr2\u662f\u8981\u6bd4\u8f83\u7684\u5b57\u7b26\u4e32\u53d8\u91cf\u7684\u540d\u79f0\uff0cresult\u662f\u6bd4\u8f83\u7ed3\u679c\uff0c\u5982\u679cstr1\u548cstr2\u76f8\u7b49\uff0cresult\u7684\u503c\u4e3a0\uff1b\u5982\u679cstr1\u5927\u4e8estr2\uff0cresult\u7684\u503c\u5927\u4e8e0\uff1b\u5982\u679cstr1\u5c0f\u4e8estr2\uff0cresult\u7684\u503c\u5c0f\u4e8e0\u3002<\/p>\n

\u603b\u7ed3<\/h2>\n

  \u672c\u6587\u4ecb\u7ecd\u4e86STM32\u5982\u4f55\u5b9a\u4e49\u5b57\u7b26\u4e32\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528\u5b57\u7b26\u4e32\u6765\u5b9e\u73b0\u4e00\u4e9b\u5e38\u89c1\u7684\u64cd\u4f5c\u3002<\/strong>\u5728STM32\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u6570\u7ec4\u6216\u5b57\u7b26\u6307\u9488\u6765\u5b9a\u4e49\u5b57\u7b26\u4e32\uff0c\u53ef\u4ee5\u4f7f\u7528strlen()\u3001strcpy()\u3001strcat()\u548cstrcmp()\u51fd\u6570\u6765\u64cd\u4f5c\u5b57\u7b26\u4e32\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

STM32\u662f\u4e00\u79cd\u57fa\u4e8e32\u4f4d\u5fae\u63a7\u5236\u5668\u7684\u5904\u7406\u5668\uff0c\u5b83\u53ef\u4ee5\u5904\u7406\u590d\u6742\u7684\u6570\u636e\u5904\u7406\u4efb\u52a1\uff0c\u5e76\u53ef\u4ee5\u8fd0\u884c\u591a\u79cd\u5e94\u7528\u7a0b\u5e8f\u3002\u5728STM32\u4e2d\uff0c\u5b57\u7b26\u4e32\u662f\u4e00\u79cd\u91cd\u8981\u7684\u6570\u636e\u7c7b\u578b\uff0c\u5b83\u7531\u4e00\u7cfb\u5217\u5b57\u7b26\u7ec4\u6210\uff0c\u53ef\u4ee5\u7528\u6765<\/p>\n","protected":false},"author":1,"featured_media":4132,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"categories":[36],"tags":[287],"class_list":["post-39092","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-stm32"],"_links":{"self":[{"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/posts\/39092"}],"collection":[{"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/comments?post=39092"}],"version-history":[{"count":0,"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/posts\/39092\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/media\/4132"}],"wp:attachment":[{"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/media?parent=39092"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/categories?post=39092"},{"taxonomy":"post_tag","embeddable":true,"href":"\/\/www.viralrail.com\/wp-json\/wp\/v2\/tags?post=39092"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}