CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

print array

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
filjoa



Joined: 04 May 2008
Posts: 260

View user's profile Send private message

print array
PostPosted: Thu May 22, 2008 10:02 am     Reply with quote

Hi

I have this array:
Quote:
161229.000,A,3723.2475,N,12158.3416,W,0.13,309.62,120598,,


is possible I save an part, for example "29" into variable?

in normal case i make:

strcpy(string1,"29");

but how I have an array a need copy to string1 position 4 and 5....

how I can make that? some one can help me?

regards
KU5D



Joined: 10 Feb 2008
Posts: 46
Location: Asheville, North Carolina

View user's profile Send private message

PostPosted: Thu May 22, 2008 10:19 am     Reply with quote

I assume you have already captured the GPS string into an array or buffer, let's assume that buffer is defined as"gpsString[bufferSize].

Now you wanna grab the UTC seconds out of this string. Your string is:

161229.000,A,3723.2475,N,12158.3416,W,0.13,309.62,120598,,

Here we go.
Code:


int8  secTens;
int8  secOnes;
int8  utcSeconds;

secTens = (gpsString[4] - 30) * 10;  //converting ASCII char to int
secOnes = gpsString[5] - 30;
utcSeconds = secTens + secOnes;



There's my quick and dirty lunch-hour answer. This assumes also that you have ripped out the preceding $GPRMC, otherwise the position in the string will be off.
_________________
Confidence is the feeling you have right before you fully understand the situation...
filjoa



Joined: 04 May 2008
Posts: 260

View user's profile Send private message

PostPosted: Thu May 22, 2008 10:29 am     Reply with quote

hi

thank but my problem dont stay there.
I have this string saved but need Concatenate some parts of this string.

for example used this string a like have at the end:

str1=37d23.2475' N 121d58.3416' W

how I can make this?

regards
KU5D



Joined: 10 Feb 2008
Posts: 46
Location: Asheville, North Carolina

View user's profile Send private message

PostPosted: Thu May 22, 2008 10:51 am     Reply with quote

Uhmmm...

I'm sorry, but I don't understand the question? Can you clarify for me a bit?
_________________
Confidence is the feeling you have right before you fully understand the situation...
filjoa



Joined: 04 May 2008
Posts: 260

View user's profile Send private message

PostPosted: Thu May 22, 2008 11:36 am     Reply with quote

Hi

I have this string:
161229.000,A,3723.2475,N,12158.3416,W,0.13,309.62,120598,,
on a variable... but I like print some parts of them. this string have be saved on variable string[60].

I like print some like that:"37d23.2475' N 121d58.3416' W" and save them into other variable, for example str1.

is possible?
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Thu May 22, 2008 12:41 pm     Reply with quote

I think you need to read a beginners instruction book for C. Your focus should be on how C handles strings. When you have mastered extracting a subset of a string you will be able to address your issues on your own. You are in the weeds with a GPS sentence. Someone on this board might do the work for you but as soon as you make any modification you will be back asking how to make it work again. Take a few days and read about C and strings it will be more productive than waiting for a stranger to do the work for you
filjoa



Joined: 04 May 2008
Posts: 260

View user's profile Send private message

PostPosted: Thu May 22, 2008 2:03 pm     Reply with quote

Hi

yes you have reason... I find for instruction for C and I resolve the problem...

one more question...

if I have an float is possible convert this to a char[]?

the function ITOA make that? if yes it put '\0' on the string?

regards
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group