When I compiled the code (given below), I
was in the subdirectory where the code is located, which is /data1/n5775/. I have also sent the code to a friend's computer and was able to compile it successfully there.
#include
#include
int main(void)
{
float vel1,vel2,ii,rms,ii_rms;
char l[80],offset[10];
int i;
FILE *fp,*fp2;
fp = fopen("co10iram_integrated_intensity_table.dat","r");
fp2 = fopen("co10iram_rms_integrated_intensity.dat","w");
/* bypassing file comments */
for (i=0; i18; ++1)
fgets(l,80,fp);
/* reading in data and calculating rms of integrated intensity */
while (fgets(l,100,fp) != NULL)
{
sscanf(l,"%c %f %f %f %f",&offset,&vel1,&vel2,&ii,&rms);
ii_rms = sqrt((vel2-vel1)/3.269)*3.269*rms;
fprintf(fp2,"%c %f %f %f %f \n",&offset,&vel1,&vel2,&ii,&ii_rms);
}
}
Also, what's the math header file? (response 2)
I don't understand the command g++ -o test test.cpp ~ (response 3). Pray explain.
Thanks very much.
Siow-Wang