PDA

View Full Version : how to update a record in a file??



ashwini_rt
04-30-2010, 11:47 PM
hii everyone1..

how can i update a text file i,e only one particular record in a file i'm using openGL with vc++ ... my sample code to write into a text file when a store button is clicked is over here..after every 8sec i have to update only x_quad and y_quad how can that be done..can any one help me out??



case STORE_BUTTON:

fptr=fopen ("target.txt", "w");
fclose(fptr);

fptr=fopen("target.txt","a+");
if(radiogroup_item_id==0)
strng="incomming";
else if(radiogroup_item_id==1)
strng="outgoing";
compute(az,sr,er,strng);

if(no>=1)
{
no=no-1;
if(tid <= 10)
{


printf("STORE Button clicked....Stored to a file!\n");
fprintf(fptr, "Target id=%d\n", tid);
fprintf(fptr, "%s\n", strng);
fprintf(fptr, "speed=%f\n", speed);
fprintf(fptr, "Azimuth=%d\n", az);
fprintf(fptr, "Heading=%d\n", hh);
fprintf(fptr, "Start range=%d\n", sr);
fprintf(fptr, "End Range=%d\n",er);
fprintf(fptr, "Point: %f, %f\n\n", x_quad, y_quad);
}
else if(no==0 || tid>10)
fclose(fptr);
}


tid++;
break;

ZbuffeR
05-01-2010, 04:57 AM
You should really REALLY learn to do your job, go to a beginner coding forum, then come back when you will have actual questions about OpenGL.