Writing input into separate arrays and an output file The code inputs an int, n, which is the number of lines to follow. Then, on each line, the first number goes to array A, the second to B, and the third to C. I then pass these 4 arguments to sub which I have no control over (in an object file where I don't know the implementation). All I know is that it returns an int.
What I do then is write n, the three arrays, and the result of sub into an output file. Pretty simple code.
This code works as expected, but I just want to see if there are any conventions I should be following (especially C++11) and ideas to consider for efficiency.
#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;vector&gt;
#include &lt;string&gt;
#include &lt;sstream&gt;
#include &quot;sub.h&quot;

int main()
{
    std::ifstream file;
    file.open(...);

    if (!file) {
        std::cerr &lt;&lt; &quot;Error opening file.&quot; &lt;&lt; std::endl;
        return EXIT_FAILURE;
    }
    
    int n;
    std::string firstLine;
    getline(file, firstLine);
    std::stringstream(firstLine) &gt;&gt; n;
    
    int a,b,c;
    std::vector&lt;int&gt; A1,B1,C1;
    while (file &gt;&gt; a &gt;&gt; b &gt;&gt; c) {
        A1.push_back(a);
        B1.push_back(b);
        C1.push_back(c);
    }
    
    file.close();
    
    std::ofstream output;
    output.open(...);

    output &lt;&lt; n &lt;&lt; &quot;\n&quot;;
    
    size_t size = A1.size();
    for (size_t i=0; i&lt;size; ++i) {
        output &lt;&lt; A1[i] &lt;&lt; &quot; &quot; &lt;&lt; B1[i] &lt;&lt; &quot; &quot; &lt;&lt; C1[i] &lt;&lt; std::endl;
    }
    
    //call sub method with pointer to beginning of vectors
    //I have no control over sub method, its signature is (int, int*, int*, int*)
    int n1 = sub(n, &amp;A1[0], &amp;B1[0], &amp;C1[0]);
    
    //output result and close file
    output &lt;&lt; n1;
    output.close();
}

Example input:

0 1 2 &lt;- This is A[0], B[0], C[0]
2 3 4 &lt;- This is A[1], B[1], C[1]
4 5 6 &lt;- This is A[2], B[2], C[2]

The range-based for-loop would not work in this case. It would, however, if I printed all of A, B, or C on one line.
It's a good idea to order your STL #includes either alphabetically or by groups (see this answer for more details).  Header files should also precede STL #includes to avoid dependencies.
I'd give your IO files more accurate names (such as inFile and outFile).
Include &lt;cstdlib&gt; for EXIT_FAILURE.
This is C++ and not C, so use std::size_t instead of size_t.
Put the std::vector declarations (A1, B1, C1) on separate lines.
You don't have to create another size variable for A1.size() just for a loop.

In that same loop: you're looping through all three arrays at once, but are using one vector's size to do that.  That's a bad idea.  If they happen to be different sizes, you're going to run into problems.
This:

int n1 = sub(n, &amp;A1[0], &amp;B1[0], &amp;C1[0]);


is best written as this (with iterators):

int n1 = sub(n, A1.begin(), B1.begin(), C1.begin());