Hello everybody !!
i have a problem with setw() and setfill() in this function:
void inscrire()
{int Num;
cin>>Num;
string const nomfichier("etudiant2.txt");
ofstream fout(nomfichier.c_str(), ios::app);
if (fout!=NULL)
{
fout<<setw(10)<<setfill('*')<<Num<<endl;
}
else
{
cout<<"erreur : impossible d ouvrir le fichier "<<endl;
}
}
After running i get this : ****123456 in the file
But what i want is : 123456****
Thank's , but still have the problem, the setfill() function, just complete the string in the beginning not in the end !!!!!!!!!!!!!!
okkkkkk
thank's a lot :)
that's working :
void inscrire()
{int Num;
cin>>Num;
string const nomfichier("etudiant2.txt");
ofstream fout(nomfichier.c_str(), ios::app);
if (fout)
{
fout<<setw(10)<<setfill('*')<<left<<Num;
}
else
{
cout<<"erreur : impossible d ouvrir le fichier "<<endl;
}
}