Globbing with MinGW on Windows

Posted by Neil Butterworth on Stack Overflow See other posts from Stack Overflow or by Neil Butterworth
Published on 2010-06-01T15:19:46Z Indexed on 2010/06/01 15:23 UTC
Read the original article Hit count: 325

Filed under:
|
|
|
|

I have an application built with the MinGW C++ compiler that works something like grep - acommand looks something like this:

myapp -e '.*' *.txt

where the thing that comes after the -e switch is a regex, and the thing after that is file name pattern. It seems that MinGW automatically expands (globs in UNIX terms) the command line so my regex gets mangled. I can turn this behaviour off, I discovered, by setting the global variable _CRT_glob to zero. This will be fine for bash and other sensible shell users, as the shell will expand the file pattern. For MS cmd.exe users however, it looks like I will have to expand the file pattern myself.

So my question - does anyone know of a globbing library (or facility in MinGW) to do partial command line expansion? I'm aware of the _setargv feature of the Windows CRT, but that expands the full command line. Please note I've seen this question, but it really does not address partial expansion.

© Stack Overflow or respective owner

Related posts about c++

Related posts about c