Thread: problem with strcat

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    7

    problem with strcat

    Hello im kinda new with C++ and im trying to have a program that reads in a keyboard press while the programs continues to run. i seem to have that part of it ok but im trying to create a string with each new key pressed but i get a error that i cant seem to get around. Any help would be good
    Code:
    #include <iostream>
    #include <conio.h>
    #include <ctype.h>    //please do not worrry about all these headers 
    #include <cstring>	  // i have been trying different commands
    #include <stdio.h>
    
    using namespace std;
    int main(void)
    {
    	char string[256];
    	int kb;
    	while(kb!= 27)
    	{
    	if (_kbhit())
    		{
    		kb =_getch();
    		_putch(kb);
    		if (kb != 13)
    		{
    			string[0] = '\0';
    			char c = char(kb);
    			strcat(string, c);  // problem is here. i get a error which is 
    								//" cannot convert parameter 2 from 'char' to 'const char *'"
    		}
    		}
    	}
    }
    Last edited by morngrym; 02-19-2010 at 01:06 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. STRCAT problem
    By Frusciante in forum C Programming
    Replies: 9
    Last Post: 07-04-2007, 06:15 AM
  2. Problem with strcat
    By firyace in forum C Programming
    Replies: 9
    Last Post: 05-15-2007, 02:31 PM
  3. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  4. Problem with strcat() function
    By sureshkumarct in forum C Programming
    Replies: 6
    Last Post: 01-03-2007, 08:05 PM
  5. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM