In short, currently the code below outputs: The substring is AES
. Unfortunately, I'm looking to get the result The substring is 100
. This is due to the fact that strsep()
keeps only the first portion of the split, and not the second. Is there a way to make the 2nd portion the one that's kept instead?
#include <stdio.h>
#include <string.h>
int main () {
const char haystack[50] = "SHA1 = 99\nAES = 100";
const char needle[10] = "Point";
char *ret;
char *bonus;
ret = strstr(haystack, "AES");
bonus = strsep(&ret, "=");
printf("The substring is: %s\n", bonus);
return(0);
}