Hi All,
Does anyone know, how to substring a set of characters
given the start and end positions ?
I am trying to cut a long string into chunks of 250
characters and store them in an array.
Thanks in advance.
Hi All,
Does anyone know, how to substring a set of characters
given the start and end positions ?
I am trying to cut a long string into chunks of 250
characters and store them in an array.
Thanks in advance.
Code:char buff[100][251]; for ( i = 0, j = 0 ; i < n ; i += 250, j++ ) { strncpy( buff[j], &line[i], 250 ); buff[j][250] = '\0'; }
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.