You should use scanf to read the input. 
Since your program reads from standard input, it would be possible to type all the input to your program from the keyboard. But typing in a listing that looks like the output from ls -l even once would be awful. Instead you could run ls -l and pipe its output to your program. Make sure you understand that last sentence and try it out. Even better, you should run ls -l and redirect its output to another file. Then edit that file to create different versions that thoroughly test your program. Now run your program and redirect standard input to read from one of the test input files that you just created.