LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-03-2005, 08:59 PM   #1
crapodino
Member
 
Registered: Aug 2005
Distribution: SuSE 10
Posts: 72

Rep: Reputation: 15
problem with setiosflag


hi! first, sorry for my english, i am argentinian....I am using c++ and i need to justify to the left ( by default is to the right ). So, i tried to use setiosflag, but u had a compile error:
setiosflag undecleared .....

i have this:

using namespace std;
#include <iomanip>
#include <iostream>
#include <fstream>

int main() {

cout<<"hola"<<setw(15)<<setfill(' ')<<setiosflag(ios::left)<<endl;
cin.get();
}


I've proved this in devcpp for windows and with kdevelop in suse linux 9.3

thanks
 
Old 11-03-2005, 09:00 PM   #2
lowpro2k3
Member
 
Registered: Oct 2003
Location: Canada
Distribution: Slackware
Posts: 340

Rep: Reputation: 30
change

using namespace std;
#include <iomanip>
#include <iostream>
#include <fstream>

to

#include <iomanip>
#include <iostream>
#include <fstream>
using namespace std;
 
Old 11-03-2005, 09:05 PM   #3
crapodino
Member
 
Registered: Aug 2005
Distribution: SuSE 10
Posts: 72

Original Poster
Rep: Reputation: 15
thanks por your velocity...but the same....
 
Old 11-03-2005, 09:09 PM   #4
lowpro2k3
Member
 
Registered: Oct 2003
Location: Canada
Distribution: Slackware
Posts: 340

Rep: Reputation: 30
hmm..

i haven't used setfill(..) before, but that code looks fine to me



are you sure its not setiosflags()?
 
Old 11-03-2005, 09:11 PM   #5
crapodino
Member
 
Registered: Aug 2005
Distribution: SuSE 10
Posts: 72

Original Poster
Rep: Reputation: 15
setfill works fine, my problem is in setiosflag. Just in case!!
If if comment that , it dosn't appear the error.
 
Old 12-26-2007, 08:17 AM   #6
ekinakoglu
Member
 
Registered: Jul 2007
Location: Turkey
Distribution: Slackware64 14.2
Posts: 35

Rep: Reputation: 15
setiosflag(ios::left) with gcc

Your solution might be something like this:


#include <iomanip>
#include <iostream>
#include <fstream>
using namespace std;

int main()
{
cout.setf(ios::left);
cout << "hola" << setw(15) << setfill(' ') << endl;
cin.get();
}
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
perl problem? apache problem? cgi problem? WorldBuilder Linux - Software 1 09-17-2003 07:45 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration