|
From: Carlos d. M. <cg...@wo...> - 2002-06-04 17:33:50
|
Hi:
Some days ago I wrote about I could not make grpof write its output to a
file, because adding it to tools menu with parameters exefilename
gmon.out > outfile did not work since > do not work there.
I have written a tiny program which redirects to gprof, so you can add
to the tools it with parameters gprof (if you do not have your
dev-c++\bin directory set in your system you'll need add it before
it(C:\Dev-Cpp\Bin\gprof)) <EXENAME> <PROJECTPATH>gmon.out ' (or >)
path\outfile.
(I use gprof <EXENAME> <PROJECTPATH>gmon.out ' <PROJECTNAME>.txt)
The program says that ' is converted to >, but if you type > directly it
works.
I add the source, paste it and compile. The comments are lines which I
put for first tests of the program. I sent the executable, but it seems
that this mailing list does not accept them.
You can delete de system("PAUSE"); if you want, of course, you'll don't
have any information having to quit the console each time you run it.
menugprof.cpp:
#include <iostream.h>
#include <stdlib.h>
#include <string.h>
//#include <string>
//using namespace std;
int main(int argc, char *argv[])
{
char alm[1000];
char def[1000] = "\0";
int cuan = argc;
int con;
//string pos;
for(con = 1; con < argc; con++){
if(static_cast<int>(*argv[con]) == 39)
*argv[con] = static_cast<char>(62);
strcat(def, argv[con]);
strcat(def, " ");
}
cout << def << endl;
system(def);
system("PAUSE");
return 0;
}
|