hi!
I programming from 1992,some about an average of 16 houres per day .. in several languages,script languages,markup languages,...
never in c++
(in 2009 not sure i download a version of pelles c ,then after i try it i delete it
)
yesterday using several pdf,chm manuals and stackoverflow "how to" questions i recode a purebasic program (a x64 compiler in windows 10 x64) in a code::blocks program that works , then i tryed TINY C and works too , and now in PELLES C that compile that crap but nothing happening.
This program loads in an output of a bench program, a stress tool to simulate several connection in apache, is about ab.exe.
i have xampp installed standard in C:\xampp\
the program had 2 versions :
one for the command
"c:\xampp\apache\bin\ab.exe" -l -n 5000 -t 1 http://localhost/0/(in localhost i have my php framework that i benchmark 10 times and I calculate the average very well in purebasic=the cpu is under 40%)
the another for
"C:\xampp\apache\bin\ab.exe", "-t 1 -c 10 -k -H -q"Accept-Encoding: gzip, deflate" http://localhost/0/(what ever in cmd.com or purebasic program i got on this almost 82% of my cpu ,and on c++ compilers 100% !!!)
the script i recoded with what "i learn" from Saturday -24 houres ago to Sunday now is this one:
/*
#include <iostream>
// run this program using the console pauser or add your own getch, system("pause") or input loop
int main(int argc, char** argv) {
return 0;
}
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <io.h>
#include <string.h>
int main( void )
{
float sum;
char psBuffer[128];
FILE *pPipe;
/* Run DIR so that it writes its output to a pipe. Open this
* pipe with read text attribute so that we can read it
* like a text file.
*/
sum=0;
for( int a = 0; a < 10; a = a + 1 ) {
if( (pPipe = _popen( "c:\\xampp\\apache\\bin\\ab.exe -l -n 5000 -t 1 http://localhost/0/", "rt" )) == NULL )
exit( 1 );
/* Read pipe until end of file, or an error occurs. */
char * pch,* pch2 ,* pch3 ;
char * start,stop;
while(fgets(psBuffer, 128, pPipe))
{
pch = strstr (psBuffer,"Requests per second:");
// if(psBuffer.find("Requests per second:"))
if(pch!=NULL){
// printf(pch);
//printf(psBuffer);
start=pch+20;
pch2 = strstr(pch,"[");
// printf(pch2);
pch3 = strtok (pch,"Requests per second:");
// while (pch3 != NULL)
// {
//printf ("%s\n",pch3);
float fr=atof(pch3);
sum=sum+fr;
//printf("%.2f\n",sum);
//printf("%d\n",sum);
// printf("%.2f\n", atof(pch3));
// printf("%.2f\n", sum);
// pch3 = strtok (NULL, "Requests per second:");
// }
}
}
/* Close pipe and print return value of pPipe. */
/*
if (feof( pPipe))
{
printf( "\nProcess returned %d\n", _pclose( pPipe ) );
}
else
{
printf( "Error: Failed to read the pipe to the end.\n");
}*/
// printf("%d\n",sum);
}
printf("%.2f\n",sum/10);
system("pause 0");
}
so my stupid question is : what is wrong-why is compiling but never work in Pelles C ? Thanks