Not technically formatting but positioning non the less.
I am new to C++ and am trying to make a basic program that opens a text file, reads it, and displays the information like so:
Computer names, and IP's of users
ComputerName xxx.xxx.xxx.xxx UserName
ComputerName xxx.xxx.xxx.xxx UserName
ComputerName xxx.xxx.xxx.xxx UserName
etc etc
I can't seem to get the hang of what seems a pretty simple (simple...) task of working with file streams.
The basic code (before I deleted it) looked something like this.
Int main(){
char ch;
ifstream fin ("list.txt");
while (fin.get(ch))
{
cout << ch;
}
Which would output the whole document, in an unformatted fashion like so
ComputerName 192.192.192.192 RandomUserName
ComputerName 192.192.192.50 OtherRandomUserName
ComputerName 192.192.192.30 SomeOtherRandomUserName
It is a simple task but no matter what I do I can not make strings of individual computer names, ip, username etc with out massive compile errors.
If someone could simply point me the right way I would be happy.
Also I tried the google machine for this but kept finding contradictory articles. eg Some would use peek() to add spacing, and others would use other methods that I couldn't find header files and what not.
Any help is appreciated.
Thanks
Signed,
Noob