I have a relatively large text as follows:
//@Function name: abs
//Function prototype: int abs(int x);
//Function purpose: find the absolute value of integer x
//Function return: calculation result
//Parameter description:
//Header file: <math.h>,<stdlib.h>
//Usage example:
#include <stdio.h>
#include <math.h>
int main()
{
int number=-1234;
printf("number: %d absolute value: %d",number,abs(number));
return 0;
}
//@Function name: fabs
//Function prototype: double fabs(double x);
//Function purpose: find the absolute value of x.
//Function return: calculation result
//Parameter description:
//Header file: <math.h>
//Usage example:
#include <stdio.h>
#include <math.h>
int main()
{
float number=-1234.0;
printf("number: %f absolute value: %f",number,fabs(number));
return 0;
}
//@Function name: sin
//Function prototype: double sin(double x);
//Function purpose: calculate the value of sinx. Sine function
//Function return: calculation result
//Parameter description: the unit is radians
//Header file: <math.h>
//Usage example:
#include <stdio.h>
#include <math.h>
int main()
{
double result,x=0.5;
result=sin(x);
printf("The sin() of %lf is %lf",x,result);
return 0;
}
.........
I want to use the text before each "//@Function name" as the boundary, and split each C-language function description into a separate text file named after the function name.
Since there are quite a lot of them, I want to do it with a batch file, but I don't know how to start. Hope an expert can give me some pointers?
[ Last edited by zzhh612 on 2007-3-29 at 09:49 AM ]
//@Function name: abs
//Function prototype: int abs(int x);
//Function purpose: find the absolute value of integer x
//Function return: calculation result
//Parameter description:
//Header file: <math.h>,<stdlib.h>
//Usage example:
#include <stdio.h>
#include <math.h>
int main()
{
int number=-1234;
printf("number: %d absolute value: %d",number,abs(number));
return 0;
}
//@Function name: fabs
//Function prototype: double fabs(double x);
//Function purpose: find the absolute value of x.
//Function return: calculation result
//Parameter description:
//Header file: <math.h>
//Usage example:
#include <stdio.h>
#include <math.h>
int main()
{
float number=-1234.0;
printf("number: %f absolute value: %f",number,fabs(number));
return 0;
}
//@Function name: sin
//Function prototype: double sin(double x);
//Function purpose: calculate the value of sinx. Sine function
//Function return: calculation result
//Parameter description: the unit is radians
//Header file: <math.h>
//Usage example:
#include <stdio.h>
#include <math.h>
int main()
{
double result,x=0.5;
result=sin(x);
printf("The sin() of %lf is %lf",x,result);
return 0;
}
.........
I want to use the text before each "//@Function name" as the boundary, and split each C-language function description into a separate text file named after the function name.
Since there are quite a lot of them, I want to do it with a batch file, but I don't know how to start. Hope an expert can give me some pointers?
[ Last edited by zzhh612 on 2007-3-29 at 09:49 AM ]
