Search code examples
c++c++11irc

Every time new text is displayed in IRC display the new line


I am trying to do this:

char buffer[256];
while(!buffer.getline){
    printf("%s\n",buffer);   
}
return 0;

but I am unable to use getline on buffer.

Is there any other way to do this or possibly a way to use getline?


Solution

  • you have to use:

    cin.getline(buffer,256);
    

    so your code will be:

    #include <iostream>
    using namespace std;
    int main(){
    
    char buffer[256];
    while(cin.getline(buffer,256)){
        printf("%s\n",buffer);
    }
    return 0;
    }