int n = NMAXVAL;
char line[MAXLINE];
int rowCount = 0;
char* token = NULL;
while (rowCount < n && fgets(line, MAXLINE, stdin))
{
    token = strtok(line, " ");
    checkToken(token, n);
    // do something
    rowCount++;
}
My function reads from stdin line by line and performs some tasks. It works fine for me on Visual Studio. However, it acts differently on xcode. It took a while for me to realize that this is caused by the difference between \n, \r, and \n\r. How do I make my code support these newline chars?
update: consider this input:
1
10
3 4
5 6 7
On visual studio, the function reads line by line. However, on Xcode it reads the first line just fine then it reads \n instead 10\n.
 
     
    