Thread: Modifying a char array in VC++ 6 ide.

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    34

    Modifying a char array in VC++ 6 ide.

    It's been awhile since I have used the VC6 ide. Is there a way to change the value of a char array while single stepping through the code?

    example: change the variable sMyString from "C:\\data\\file.txt" to "C:\\data\\testdata\\file.txt".

    thanks in advance

    clu

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    One solution is strcat(). Another solution is to store the data into a temporary string object, then modify it.

    Kuphryn

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    162
    if you make a type of class CString, it will be a heck of alot easier....without it, you could break the string up into 2 other strings, and then use strcat to combine the first with the middle part you need to add, and then strcat the end back on....again, this is pretty tedious...i forgot my notebook in the car, so i'll get the info on the way to do it using a CString

  4. #4
    Registered User
    Join Date
    Dec 2001
    Posts
    34
    My apologies as I didn't word my question very clearly. In Visual Basic, while single stepping through the code, you can change the value of a variable by assigning a new value to it using the "Immediate Window". I am wondering if VC 6 has a feature similar to this. No need to change the code or add anything, just type the new value in the Immediate Window and you are on your way.

    thanks,

    clu

  5. #5
    Registered User
    Join Date
    Feb 2003
    Posts
    162
    ooh....heh, not too familar with VB, or let alone what your really saying, so sorry

  6. #6
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    When stepping through the program, just enter 'strcpy( theArray, "HI" )' in the watch window (hit alt-3 if it isn't open) and hit enter to change the value of the char array.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 11-17-2008, 12:36 PM
  2. C++ ini file reader problems
    By guitarist809 in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2008, 06:02 AM
  3. newbie needs help with code
    By compudude86 in forum C Programming
    Replies: 6
    Last Post: 07-23-2006, 08:54 PM
  4. code help required
    By Yobbo in forum C Programming
    Replies: 9
    Last Post: 09-02-2005, 11:15 PM
  5. Strings are V important...
    By NANO in forum C++ Programming
    Replies: 15
    Last Post: 04-14-2002, 11:57 AM