Help for saving data?

I have a string which is read from serial. 3 gps module sends location information to this string. In the first loop string shows data of first gps module. Second loop shows another. This goes on. In other words i can see only one gps data during a loop.(My data type=double) How can i save all datas acquired from 3 gps module in same moment,for one loop only? Which way you can suggest? If you could reply i'd be so pleased. Look forward to your reply.

How can i save all datas acquired from 3 gps module in same moment,for one loop only?

Write the code correctly. If you need help, you have to show the code that you have.

Which Arduino are you using? Which GPSs? How are they connected? Why do you need 3 of them?

Code is attached.I use arduino uno. Gps datas came from other arduinos via xbee modules. I’m using cooking hacks modules also. moreover arduinoprintf functions writes fast and right in the if else structures.But arduinoprintf which is after from if elses is slow and sometimes stops. Look forward to your reply.

new 4.h (14.6 KB)

while(Serial.available()==0) {}
 if (Serial.available())
  {

What is going to make the while loop end? Is it really necessary to test that there is data to read, since the only way for the while loop to end is for there to be serial data?

     while(Serial.available())
     {
        data= Serial.read();
        st = st + char(data);
        //write_data(data);
        delay(1);
     }

This is a stupid way to read serial data. Waiting, in the hopes that more data arrives, just doesn't cut it. Assuming that a packet is complete when there is no more data and nothing has arrived in the last millisecond is not a good idea.

  Serial.flush();

Block until all pending outgoing serial data has been sent. How does THAT make sense?

Gps datas came from other arduinos via xbee modules.

Why don't they identify themselves? How do you know which one you just got data from?