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
Printable View
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
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;
}
Tried out your solution, it just opens the files (xyz) in notepad :confused:
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
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;
}
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
Salem said what? :p
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;
}
Ah, sorry, yes I got confused, and as I only tested my eyes for these glasses about 3 months ago, I think they are OK still (actually, only 2 weeks or so ago, they checked my eyesight for a medical test too, and that was OK too). Probably more bitrot in the RAM.
--
Mats
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?