I don't think you can use the insertion operator (
>>
) to read into an array. You should use
read()
[
^] or
getline()
[
^].
As to your second point why use brackets in the first place? If you do not include a filename then
argc
will have the value 2, to indicate that
argv[2]
does not exist.