How to get text to align left when using width(X)

This is a discussion on How to get text to align left when using width(X) within the C++ Programming forums, part of the General Programming Boards category; Anyone know how. the default seems to be left alignment. Also anyone know how to use the sleep function and ...

  1. #1
    Darksbane
    Guest

    How to get text to align left when using width(X)

    Anyone know how. the default seems to be left alignment. Also anyone know how to use the sleep function and what I have to include to get it to work. This is all in Visual C++

  2. #2
    Darksbane
    Guest

    also...

    anyone know what the command is to clear the screen.

    is there any easy way to give a C++ program a GUI feel. VB has the drag and drop thing going does VC++ have anything similar?

  3. #3
    Darksbane
    Guest

    I just keep coming up with more...

    is there a way to read in a file name during a program and then open it.

    I was thinking something like:

    cin >> FileName;
    myin.open(FileName);

    but myin.open doesn't like a string variable there it just seems to want myin.open("file.txt");

    Any suggestions?

  4. #4
    Darksbane
    Guest

    Help

    Help please! Anyone?

  5. #5
    Registered User
    Join Date
    Aug 2001
    Posts
    155
    output streams like cout are instances of the ostream class or classes derived therefrom. ostream has a number of manipulator functions and can use a number of ios class flags. You can review the options in chapter 16 of J. Liberty's book Teach Yourself C++ in 21 days available at the following site in full text version.

    http://www.stud.fim.ntnu.no/~oystesk/CPP/index.htm

    The clear screen topic is a common one addressed on this board many times, and may even be in the FAQ section, although I haven't looked as I use Borland compilers which have the conio.h file that includes the clrscr() function. Unfortunately conio.h is not a standard file and is not available in all compilers. You can search this site for other options.

    Borland C++ Builder reportedly has a system of drag and drop similar to VB. Since I don't use VB or VC++ I can only report what I have heard.

    The open() function of streams only takes c_style (null terminated char arrays) strings as parameters. If you use other style strings you must convert them to c_style strings to be used in open().

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. edit control text buffer
    By scurvydog in forum Windows Programming
    Replies: 4
    Last Post: 12-11-2008, 10:13 AM
  2. Render text
    By Livijn in forum C++ Programming
    Replies: 6
    Last Post: 07-06-2007, 04:32 PM
  3. How to use FTP?
    By maxorator in forum C++ Programming
    Replies: 8
    Last Post: 11-04-2005, 03:17 PM
  4. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 10:45 PM
  5. how to align text?
    By kuyajay in forum C++ Programming
    Replies: 3
    Last Post: 02-22-2002, 02:51 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21