strcat() giving me an illegal opertaion???

This is a discussion on strcat() giving me an illegal opertaion??? within the C++ Programming forums, part of the General Programming Boards category; This code compiles fine, but i get an illegal operation once the program gets to the strcat() line, and i ...

  1. #1
    Registered User Ion Blade's Avatar
    Join Date
    May 2002
    Posts
    35

    Angry strcat() giving me an illegal opertaion???

    This code compiles fine, but i get an illegal operation once the program gets to the strcat() line, and i have no friggin clue.

    the program reads from a file called settings and gets the first line of it, which is a directory to install something to.
    (c:\whatever\whatever)

    Code:
    char *copy = "copy ";
    char installdir [64];
    
    ifstream settings ("settings.cfg");
      if (!settings.is_open())
      {
          cout<<"Configuration file (settings.cfg) not found.\n";
      }
      settings.getline (installdir, 64, '\n');
      settings.close();
      strcat (copy, installdir);
    i am trying to append the installdir to the word "copy" so i can use this in a system(copy).
    Anyone know why i am getting an illegal op?
    "Im going to have peaceful dreams of brackets and semicolons strapped on crucifixes, screaming for mercy" - Someone who doesn't like programming.

  2. #2
    Registered User subdene's Avatar
    Join Date
    Jan 2002
    Posts
    359
    Is the destination variable big enough to hold the data you are trying to concatenate? The varaible copy is not big enough.

  3. #3
    Registered User Ion Blade's Avatar
    Join Date
    May 2002
    Posts
    35
    Thank you

    Now my program can near it's completion...
    "Im going to have peaceful dreams of brackets and semicolons strapped on crucifixes, screaming for mercy" - Someone who doesn't like programming.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C2100 Illegal Indirection error?
    By dnguyen1022 in forum C++ Programming
    Replies: 1
    Last Post: 06-18-2009, 10:47 PM
  2. Replies: 3
    Last Post: 05-24-2009, 02:42 AM
  3. argv change
    By dracayr in forum C Programming
    Replies: 9
    Last Post: 04-10-2009, 02:49 AM
  4. SSH Hacker Activity!! AAHHH!!
    By Kleid-0 in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 03-06-2005, 02:53 PM
  5. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21