why this code doesn't work

M

mohamed azaz

int main()
{
cout.setf(ios::failbit);

if(cout.fail())
cout<<"error "<<endl;

return 0;
}



why it doesn't set the formating flag in visual studio 2005

all formatin flag doesn't set


I want quick answer please
thank you
bye
 
M

Markus Moll

Hi

mohamed said:
int main()
{
cout.setf(ios::failbit);

if(cout.fail())
cout<<"error "<<endl;

return 0;
}



why it doesn't set the formating flag in visual studio 2005

What is it supposed to do? ios_base::setf expects a fmtflag, you are passing
an iostate. Your code snippet won't compile for a number of other reasons
as well.
all formatin flag doesn't set

I do not understand what you are saying here.
I want quick answer please

I guess some people may consider that statement impolite, even with the
added "please".

Markus
 
M

mohamed azaz

thank you for your notes

I want to set a format flag what is the right code


example

format flag as (right)or(left)

thank you

bye
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,196
Latest member
ScottChare

Latest Threads

Top