Hi,
I need to create an array of strings. The input will include spaces, and I need the program not to terminate if a space is entered by the user. Any tips?
What library will you be using?
MFC?
STL?
A combination?
If you open a stream using the IOS library in the STL you can call a getLine function that doesn't terminate until, obviously, you have reached the end of the line. Is this what you're looking for? MYenigmaSELF:-9 myenigmaself@myenigmaself.gaiden.com
istream& getline( char* pch, int nCount, char delim = '\n' ); pch
A pointer to a character array. nCount
The maximum number of characters to store, including the terminating NULL. delim
The delimiter character (defaults to newline).
an example:
#include <iostream.h>
.....
.......
char *array = new char[100];
.....
cin.getline( array, 100, '\n' ); // or simply cin.getline( array, 100 )
....
.....
delete array;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.