Created
August 29, 2018 13:51
-
-
Save OctoberWu/fb72aea8569954543eadd0eb3ca683bb to your computer and use it in GitHub Desktop.
#string_operation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
============================================================================ | |
Name : findLastof.c | |
Author : octoberwu | |
Version : | |
Copyright : Your copyright notice | |
Description : Hello World in C, Ansi-style | |
============================================================================ | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int main(void) { | |
char *path = "/dev/ttyS2"; | |
char *pch; | |
pch = strstr(path, "ttyS"); | |
//if(pch != NULL){ | |
//pch = strchr(pch+1, 'S'); | |
//} | |
//pch = pch + 3; | |
int ret; | |
pch += strlen("ttyS"); | |
//printf("this is %s\n", pch); | |
//if(isdigit(*pch)) | |
// puts("I am digits\n"); | |
printf("strstr: %s\n", pch); | |
ret = atoi(pch); | |
printf("The Integer: %d\n", ret); | |
puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */ | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment