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++
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 ...
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++
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?
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?
Help please! Anyone?
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().