CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Help ! Help!

  1. #1
    Join Date
    Apr 1999
    Posts
    121

    Help ! Help!

    I hope someone can help me. I'm trying to get two string from my vector listOfFilesToCopy. The first forloop is to get my source path in a string. So I was trying to get the length of that and then I thought I would try to build my string but I'm not sure how. If anyone understand what I'm trying to do please help me.

    void CVRUtilitiesApp::CopyFiles( vector<FileToCopy> &listOfFilesToCopy)
    {

    int bufferSrc = 0;
    int bufferDst = 0;
    for(int i=0; i<listOfFilesToCopy.size(); i++){
    Path file = listOfFilesToCopy[i].GetSrc();
    CString fileName = ToCString(file.GetPath());
    long len = fileName.GetLength();
    long finalLen = len + 1;
    bufferSrc+= finalLen;
    }

    }

    class FileToCopy
    {
    private:
    File src;
    File dst;

    public:
    FileToCopy( const File &src_, const File &dst_)
    : src( src_), dst( dst_)
    {
    }
    FileToCopy()
    {
    }

    const File &GetSrc() const { return src; }
    const File &GetDst() const { return dst; }

    };


  2. #2
    Join Date
    Apr 1999
    Location
    France
    Posts
    35

    Re: Help ! Help!

    Ok let me try to help you althought your source code is not so clear.
    What is Path ?
    Ok ok every programmer gets its own behavior.

    If you use CString objects, it's very simple to concatenate or add strings.
    I suppose you want to generate the full path including Pathname and Filename ?
    Once you've extracted CString Path just add Filename to it :
    CString Path, Filename;
    Path = ..... ;
    ...
    Filename = ....;
    ...
    Path += Filename;

    hope it helps !


    C++ developer
    Faculté de Médecine
    27 Bd Jean Moulin
    13385 Marseille cedex 05

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