Q:

Command Line Test Program -> Only producing first part

The assignment given in class was to test arguments that where provided.The code that wrote(added to this topic) works ( in the sense that it runs) ,  but it only produces the first word or set of words.
Code:
#include <fstream>
#include <iostream>
using namespace std;

int main ( int argc , char *argv[] )
{
    if(argc > 1 )
    {
        cout << argv[1] << endl;
    }
    else
    {
        return -1;
    }
    ifstream infile(argv[1]);
    if (infile.is_open())
    {
        string words;
        while (infile >> words)
        {
            cout << words <<endl;
        }
    }
    else
    {
        return -1;
    }
    infile.close();
}

The given line is :
"This is true" "This is fact"
The outcome it(code) produces is:
This is true
The outcome that I want is:
This is true , this is fact
Another Example:
The given line :
check if this thing works
Output using this code :
check
Wanted output:
check, if, this, thing, works
My question is if I am not adding something in my code that will produce the whole line. Also, I know that my code does not add "," to the output, but I want to worry about one issue at a time. 
Some more information: 
The file is read and if there is no arg then it does not produce anything, it also works if there is only one arg. he code stops working at more then one arg and quotes.

A:

This line cout << argv[1] << endl; will print your first command line argument (after argument zero which is the application name) to the screen. Command line arguments wrapped in double quotes are treated as a single argument so for your first example argv[1] = This is true and for the second argv[1] = check. That's why you see what you see.
If you understand this you should be able to figure out how to make it print the whole thing. i.e. command line arguments > 1.

