First, you should not call a variable vector. Give it a name that is not a class name from the standard library.
Secondly, it ostream_iteratorwill add ','even after the last element of the vector, which may not be what you want (the separator must be a separator, and there is nothing to separate the last value of the vector from another value).
In C ++ 11, you can use a simple forrange-based loop :
outputFile << "GLfloat vector[]={";
auto first = true;
for (float f : v)
{
if (!first) { outputFile << ","; }
first = false;
outputFile << f;
}
outputFile << "}" << endl;
++ 03 :
outputFile << "GLfloat vector[]={";
auto first = true;
for (vector<float>::iterator i = v.begin(); i != end(); ++i)
{
if (!first) { outputFile << ","; c++; }
first = false;
outputFile << *i;
}
outputFile << "}" << endl;