NMEA + Serial output with additional output

Ok, I'm working on a project that is using a Duemilanova and a EM-406A, as well throwing in a analog pressure sensor as a rocket flight computer. I am able to get the NMEA data from the serial, in this case using the NewSoftSerial library, then passing it to the serial rx port. That gives me typical (although no-lock at the moment) NMEA data in the serial port. Below is the program

#include <NewSoftSerial.h>

NewSoftSerial gps(2, 3);

void setup()
{
Serial.begin(9600);
Serial.println("Setup intiated");

gps.begin(4800);
gps.println("Hello, world?");
}

void loop()
{

if (gps.available()) {
Serial.print((char)gps.read());
}
//Serial.print('$APS ');
//Serial.println(millis());
//delay(100);
}

If i uncomment out the final 3 lines, the serial data goes crazy and gives me almost entirely the millis() command output with sometimes a random character in the front of the millis, and no $APS output. Basically this above program is a simplified version of my current program giving the same error. Below is the error text from the serial output i'm encountering:

Setup intiated
–2128054
,21280163
±21280273
Æ21280384
?21280494

21280604
Ë21280714
–21280823
,21280931
c212801038
Æ212801146
?212801255
e212801367
Ì212801478
¢212801589

The end result is that i want to output to serial the gps data as well as a set of data created by 1-2 analog sensors. This will then be passed by an XBee to a computer for further interpretation.

What exactly is my code problem, is there any examples of something like this i would be able to use?
If you have any questions let me know,
thanks DMP

One thing that is going wrong, is that your serial monitor is likely interpreting the value of millis() as characters, which explains the funky ones.
Try printing its value like this: Serial.println(millis(), DEC);

Though I don't see "Hello, world?" being printed, and the only reason I can think of that can cause that is.. that you didn't have it in your code when you copied the error?

Another problem is this bit: Serial.print('$APS ');
You should try: Serial.print("$APS ");
Single quotes denote a single character value, I'm suprised you didn't get a compiler error.
Double quotes denote a null terminated character array (practically: a string).

Imahilus, Thanks for the reply.
I switched over to the DEC format, and changed ' to " and the program was still outputting essentially the same result.
"Hello, world?" gets sent to the gps unit on the 2,3 pins, so it didnt get outputted to regular serial / usb port.
in the full program i had the same issue, only i was using basically an analog in value in place of millis().

Sorry for not noticing the gps part for hello world =P

Rather obvious what is causing your error, hitting myself in the head for not having seen this the first time around.
Try changing your if(Serial.available()) to while(Serial.available())
After it reads 1 char from your GPS unit, it does the other prints.
So offcourse you get garbled data in between your GPS values =P

Awsome, thanks for the help, that did the trick. Now the output is looking like it should, thanks alot. I figured it was something really simple lol.

$APS 5451
$APS 5561
$GPGGA,000412.033,,,,,0,00,,,M,0.0$APS 5694
,M,,0000*51
$GPGSA,A,1,,,,,,,,,,,,,,,1E
$GPRMC,000412.033,V,$APS 5868
$APS 5978
$APS 6088
$APS 6198
$APS 6308
$APS 6419
$APS 6530
$GPGGA,000413.033,,,,,0,00,,,M,0.0,M,,0000
50
$GPGSA,A,1,,,,,,PRMC,000413.033,V,,,,,,,291006,,*25
$APS 6714
$APS 6824
$APS 6935
$APS 7045
$APS 7155

Glad to be of help =)
And be glad it was just a silly problem, and not a real one that has its roots somewhere in the hardware =P