I used to be a programmer, but that was 30 years ago. The world has changed, and I have forgotten most of what I knew.
I recently downloaded an IDE and set out to write some simple command line utilities for my own use. Just wanted to play with it.
I'm working in C on Windows, 32/64-bit.
The first program I wrote cleans up some text files. It recognizes LF, CR+LF, or CR as possible line terminations for the input, optionally strips off any trailing blanks in each line, and writes out the line with whichever line terminator you want. Defaulting to the DOS/WINDOWS CR+LF for my normal environment, but I could also change the files to UNIX or MAC formats if desired.
I put in code to process multiple files if several were named as sequential arguments, or if an argument contained * or ? wildcards.
Once I got a clean compile, it seemed to work fine. But I wanted to be sure what was happening, so I put in some printfs for debugging.
I was startled to see that my code to process wildcards never got used. The program never saw them, instead something was expanding the wildcards into separate argv's for each file.
For this program that's fine, I can just delete the unused code. But the next program I planned needs to see the arguments as entered, including any wildcards, without having them expanded into multiple file specifications.
A little Googling explained the mystery. Modern versions of _setargv (the startup code to process command line arguments for main()) include the wildcard expansion, and it seems my chosen IDE defaults to one of those new versions.
I can't see where to change this in the IDE, and asking on their support forum got me a terse response that I should read a book about how to manage a complex build process.
Which eventually I might want to do, but right now I am doing simple things and didn't want to sidetrack into that. Besides, it makes my old head hurt to think about complicated stuff.
I suspect that I could just include the code for _setargv() as a module in my project, and it would link that and not call the one from their default library.
I can't find the source code they use to build the library, and I've spent a couple or three hours unsuccessfully looking for some generic version of _setargv() source on the web.
Can anyone suggest a source I can use?
I did find a version that does the expansion, and another ancient one that doesn't but uses segmented memory addressing. I suppose I can look at those and code up my own version of the function.. it doesn't look that hard. But I'd be more comfortable with code that is known to work, and I really thought it was a reasonable thing to expect to find.
Or maybe I am still missing the point and for some reason this approach will not work?