Did you try putting 'echo' before normfet.exe in the batch file? Cos it says 'prefix' and I'm wondering whether the ouput file is correctly named.
QuantumPete
Did you try putting 'echo' before normfet.exe in the batch file? Cos it says 'prefix' and I'm wondering whether the ouput file is correctly named.
QuantumPete
"No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
"Have you tried turning it off and on again?" - The IT Crowd
This is probably slightly clearer:
QuantumPeteCode:#include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { char command_string[BUFSIZ] = {0}; snprintf (command_string, "normfet.exe %s %snm -nml -ftr", argv[1], argv[1]); printf ("Executing %s\n", command_string); system (command_string); return 0; }
"No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
"Have you tried turning it off and on again?" - The IT Crowd
Tried out your solution, it just opens the files (xyz) in notepad
I tried my last solution again, it does not error out: the output of the program is normal and the prefix of the input file is there and it ends it the nm (output file name). But again, nothing is written.
But no error happens now
"No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
"Have you tried turning it off and on again?" - The IT Crowd
When batch lets you down, use C
Untested, Fix at will.Code:#include <windows.h> #include <stdio.h> int main(void) { WIN32_FIND_DATA FindFileData; HANDLE hFind; char cmd[256]; if((hFind = FindFirstFile(".\\*.xyz", &FindFileData)) == INVALID_HANDLE_VALUE) { puts("ABANDON SHIP, Y'ARRH"); return 1; } do { if(strcmp(FindFileData.cFileName, ".") == 0 || strcmp(FindFileData.cFileName, "..") == 0) continue; sprintf(cmd, "normfet.exe %s %snm -nml -ftr", FindFileData.cFileName, FindFileData.cFileName); if(CreateProcess(NULL, cmd, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, NULL) != 0) printf("Run on %s...", FindFileData.cFileName); } while (FindNextFile(hFind, &FindFileData) != 0); FindClose(hFind); return 0; }
Last edited by zacs7; 09-11-2007 at 05:12 AM.
Stick a zero in front of NORMAL_PRIORITY_CLASS, I think.
I think Salem meant that "It's up to you to fix it".
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Salem said what?
If you confused me with Salem, Either I'm getting pretty skilled, or you need glasses
Again, if i run my program like this "tnormfet.exe 5.xyz" it calls norfet.exe and it works great and outputs the file(5.xyznw)
How would i change it to scan the files on a dir and automatically loop the program for all of them?
Code:#include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { char child1[] = "normfet.exe"; char child2[BUFSIZ]; char child3[BUFSIZ]; // nome saida strcpy (child3, argv[1]); strcat (child3, "nw"); strcpy (child2, child1); strcat (child2, " "); strcat (child2, argv[1]); strcat (child2, " "); strcat (child2, child3); strcat (child2, " -nml -ftr"); printf ("Executing %s\n", child2); system (child2); return 0; }
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
That's pretty much what mine does, just replace CreateProcess with system(), a little bit of speed shouldn't matter.
By reading the FAQ perhaps?
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens