Question: I'm trying to read different lines of input through a file using scanf. I was only able to read the first line and to store it. 

here's the code I wrote. 

```
#include <stdio.h>
#include <string.h>   

int imageWidth, imageHeight, safeRegionStart, safeRegionWidth;

main(void)
{       
    int i=0, j=0; 
    int totalP, pixel, totalSafeP, concat; 
    int unsigned r,g,b;

    scanf("%d %d %d %d", &imageWidth, &imageHeight, &safeRegionStart, &safeRegionWidth);
    totalP = imageWidth * imageHeight ;
    totalSafeP = imageHeight * safeRegionWidth;
    char arr[512][50];
    char arr1[imageWidth][imageHeight];

    printf("total # of pixels: %d\nTotal # of safe Pixels: %d\n", totalP, totalSafeP);

    memset(arr,0x0,sizeof(arr));

    while(i!=totalP)
    {
        i++;
        scanf("%d", &pixel);

        /*bit shifting to get r,g,b*/       
        int r = pixel << 8;
        r = (unsigned int)logicalRightShift(r, 24);

        int g = pixel << 16;
        g = (unsigned int)logicalRightShift(g, 24);

        int b = pixel << 24;
        b = (unsigned int)logicalRightShift(b, 24);
        //printf("%d) r:%d , g:%d , b:%d\n",i, r,g,b);
        fillDescription(arr, r, g, b);

    }/*End for scanning all pixels*/
}/*end main*/ 

```

Answer: 
MY advice is to never use scanf (or fscanf) to read input. Read input using other methods (fgets, etc) and then parse the output. Possibly with sscanf, possibly with some other system. I've seen way too many errors from people reading directly with scanf.
As Vlad Lazarenko said, you're reading data from standard input. If you want to read from a file you may consider using [fscanf](http://www.cplusplus.com/reference/clibrary/cstdio/fscanf/).