CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2008
    Posts
    18

    Question String Array Problem

    Hi

    I have a problem to store variable in array.I have a two String one is Array CString as[100] and second one is simple CString sw.

    Now i want to store sw values in as[].How can i store?Plz help me

    Thanks in Advance

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: String Array Problem

    Get rid of c-type arrays.
    Use MFC CStringArray class (or std::vector) instead.
    Victor Nijegorodov

  3. #3
    Join Date
    Mar 2008
    Posts
    18

    Re: String Array Problem

    Quote Originally Posted by VictorN
    Get rid of c-type arrays.
    Use MFC CStringArray class (or std::vector) instead.
    I am doing like that
    Code:
    CString a1[100];
    CString b;
    a1[0] = strFileName1;
    a1[1] = strFileName1;
    But i am wrong some where becouse every time both a1[0] and a1[1] value changed. But i want to store different value in a1[0] 1nd a1[1]. If a1[0] have value then value store in a1[1].

    String b value every time change.Like this first time b="ssd" and second time b="mkkj". And i want to store value like that first time a1[0]="ssd" and second time a1[0]="ssd" and a1[1]="mkkj". Plz help me

    Thanks in Advance

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: String Array Problem

    Quote Originally Posted by anubhava
    ...Plz help me
    It wouldn't be a problem to help you if you'd help us to understand what you need, what and how you already tried it and what your problem is.
    Unfortunately, the four lines of sensenless code and very poor explanation don't give us any idea...
    Victor Nijegorodov

  5. #5
    Join Date
    Apr 1999
    Posts
    27,449

    Re: String Array Problem

    Quote Originally Posted by anubhava
    I am doing like that
    Code:
    CString a1[100];
    CString b;
    a1[0] = strFileName1;
    a1[1] = strFileName1;
    So what is "strFileName1"?

    Second, show us a small but complete example that duplicates the problem. (Just a main() program and a simple program that duplicates the problem that you're having).

    Regards,

    Paul McKenzie

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: String Array Problem

    try using CStringArray instead of a C style array.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured