So, the default behavior of a Linux terminal is line buffered. Something like this answer could be adapted to read one character at a time (if that is what you want).
To answer your question about getting the other 10 bytes, if you do another read, it will return the rest of those bytes. The following example demonstrates multiple sequential reads. If you enter more than 10 characters at the prompt, the second read will occur without blocking and return characters starting at 10 and up to 19. Characters beyond the 0-based index of 19 will not be printed.
#include <unistd.h>
#include <stdio.h>
int main(int argc, char** argv)
{
int read1Count = 0;
int read2Count = 0;
char pBuffer[20];
printf("Provide input: ");
// flush stdout because buffering...
fflush(NULL)
read1Count = read(1, pBuffer, 10);
// flush stdout because buffering...
fflush(NULL)
printf("Provide input: ");
read2Count = read(1, pBuffer + 10, 10);
printf("\nRead 1: '");
if (read1Count < 0)
{
perror("Error on first read");
}
for (int i = 0; i < read1Count; i++)
{
printf("%c", pBuffer[i]);
}
printf("'\nRead 2: '");
if (read2Count < 0)
{
perror("Error on second read");
}
for (int i = 0; i< read2Count; i++)
{
// We started the second read at pBuffer[10]
printf("%c", pBuffer[i + 10]);
}
printf("'\n");
}
Compiling and running this I see this
Provide input: 12345678910
Provide input:
Read 1: '1234567891'
Read 2: '0
'