Writing a vector to a file The following function (function template rather) is to take a vector of any type and write it a file using a filestream object.

template&lt;class T&gt;
void Vec_WriteFile(const vector&lt;T&gt;&amp; vec, ifstream file, char del = '\n')
{
   for (const T&amp; element : vec) file &lt;&lt; element &lt;&lt; del;
   file &lt;&lt; "\b ";
}


This function is very straightforward and simple; however, I'm a student to C++ and would love to learn different ways of doing even the simplest of tasks.
You need to include the headers your code depends on; don't assume that the user of your code will include them for you:
#include &lt;vector&gt;
#include &lt;ostream&gt;  // see note below


Never require your user to bring names into the current namespace; type names used in your public interface should always be qualified:
template&lt;class T&gt;
void Vec_WriteFile(const std::vector&lt;T&gt;&amp; vec, std::ifstream file, char del = '\n')


Don't attempt to write to an istream.  Your output should go to an ostream instead.  You could use an ofstream, but that's quite specific.  Instead, you should accept a reference to any ostream; the user can then pass an ofstream or std::cout or any other output stream:
template&lt;class T&gt;
void Vec_WriteFile(const std::vector&lt;T&gt;&amp; vec, std::ostream&amp; file, char del = '\n')


There's nothing in your code that wouldn't work for a std::list equally as well as for a std::vector, so you can be more general:
template&lt;class Container&gt;
void Vec_WriteFile(const Container&amp; vec, std::ostream&amp; file, char del = '\n')


Naming: del evokes &quot;delete&quot; in my head before I reset and think &quot;delimiter&quot;.  It might be better written in full, or perhaps as sep for &quot;separator&quot;.

Layout: at first glance, it's not obvious which code is controlled by the for condition, as you have inconsistent indentation.

Writing a backspace over the final delimiter isn't the same as not writing the delimiter.  If you want the delimiter between items but not after the final item, the usual way is to track whether the loop is in its first iteration:
bool first = true;
for (...) {
    if (first)
        first = false;
    else
        file &lt;&lt; del;
    file &lt;&lt; element;
}


Error reporting: instead of just assuming that the writes are all successful, we could report via the return value from the function.  This may help the user remember to deal with errors, which could be overlooked if they have to check the stream state after the call.

My version:
#include &lt;ostream&gt;

template&lt;class Container&gt;
std::ostream&amp; write_container(const Container&amp; c,
                     std::ostream&amp; out,
                     char delimiter = '\n')
{
    bool write_sep = false;
    for (const auto&amp; e: c) {
        if (write_sep)
            out &lt;&lt; delimiter;
        else
            write_sep = true;
        out &lt;&lt; e;
    }
    return out;
}