I have a circular buffer of of ASCII text that is 1000 bytes long. It is going to be constantly being updated and appended to.
My problem is I am using strstr() to pinpoint where a section of data starts by looking for a "$GPRMC" and I am looking for a "\r\n" to indicate the end of that block. The length will be variable and I need to find a way to determine the length of each block of data (string data) so I can then parse it further and store it into variable etc.
I tried subtracting the two pointers returned from strstr() but got a number wayyyyy to big (it was upwards of 6 billion) but in reality the string lengths are like 60-80 characters apart.
char *data, *end;
int diff;
data = strstr(&gps_buffer[gps_head], "$GPRMC");
end = strstr(&gps_buffer[gps_head], "\r\n");
diff = end - data;