CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2012
    Posts
    17

    Smile Working with File Extensions.

    Hello,
    I want to create a program which scans the extensions of files located within its same directory and
    arranges them in a newly created folder. I have done something similar with V.B, but I am not too sure
    where to start in C++. I have worked with the language and created basic console programs, so I am not
    completely C++ illiterate :-) .

    Can anyone point me in the right direction?

    Thank you.

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: Working with File Extensions.

    Take a look at FindFirstFile, and FindNextFile.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  3. #3
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Working with File Extensions.

    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  4. #4
    Join Date
    Oct 2012
    Posts
    17

    Re: Working with File Extensions.

    Thank you for your feedback.

  5. #5
    Join Date
    Oct 2012
    Posts
    17

    Re: Working with File Extensions.

    Correct me if I am wrong. The following line

    _tprintf(TEXT("Usage: %s [target_file]\n"), argv[0]);

    stores the target file name into the argv array?

  6. #6
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Working with File Extensions.

    stores the target file name into the argv array?
    No, it is getting it out of there. printf prints, scanf scans.

  7. #7
    Join Date
    Oct 2012
    Posts
    17

    Re: Working with File Extensions.

    Well, thank you guys for your help. I have a better understanding on how to use findfirstfile and findfirstfilex , and got a
    crash course on support for unicode.
    Unfortunately, I think I am over my head, I can follow along the example provided, but I have no idea on where to even
    begin coding.
    So, time to hit the books a bit more and give this a try on another occasion.
    Thanks again for your help.

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