Thread: Const Char to Char Error

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    193

    Const Char to Char Error

    Here is an example code:

    Code:
    #include <iostream>
    #include <cstring>
    
    int main()
    {
    const char* a;
    a = "Some text";
    strcat(a, "some more text");
    return 0;
    }
    Returns Error: "invalid conversion from 'const char*' to 'char*'"

    Is there any way to add "some more text" to "Some text" without changing the variable type (const char)? Also, if I try:

    strcat(a, (const char*)"some more text");

    It returns the same error. Any help is greatly appreciated.
    Last edited by stickman; 08-28-2004 at 08:37 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  3. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  4. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 03:49 PM
  5. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM