Is there a way of counting the carriage returns
Sure.
int crCnt = 0;
int lfCnt = 0;
for(int i=0; i<len; i++)
{
if(data[i] == '\n')
crCnt++;
if(data[i] == '\r')
lfCnt++;
}
Do this first, to see if there are carriage returns and line feeds, just carriage returns, or just line feeds.
Or spotting the two carriage returns together then selecting the next character
Sure.
int doubleCRPos = 0;
for(int i=0; i<len; i++)
{
if(data[i] == '\n')
{
if(i < len-2)
{
if(data[i+1] == '\n' || (data[i+1] == '\r' && data[i+2] == '\n')
{
doubleCRPos = i+1;
}
}
}
}
if(doubleCRPos > 0)
{
// The data of interest will be at data[doubleCRPos+1] or data[doubleCRPos+2]
// depending on whether there are CRs or LFs only or CR and LFs
}