Click here to Skip to main content
15,913,836 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CFileDialog Save As file name extension change Pin
Mark Salsbery14-Oct-08 8:30
Mark Salsbery14-Oct-08 8:30 
QuestionDLL Lookup based on UUID Pin
bulg8-Aug-08 13:05
bulg8-Aug-08 13:05 
AnswerRe: DLL Lookup based on UUID Pin
Randor 10-Aug-08 5:13
professional Randor 10-Aug-08 5:13 
GeneralRe: DLL Lookup based on UUID Pin
bulg12-Aug-08 12:34
bulg12-Aug-08 12:34 
QuestionC++ Lat and Long distance question Pin
winburn8-Aug-08 11:22
winburn8-Aug-08 11:22 
AnswerRe: C++ Lat and Long distance question Pin
Perspx8-Aug-08 11:37
Perspx8-Aug-08 11:37 
GeneralRe: C++ Lat and Long distance question Pin
winburn8-Aug-08 11:43
winburn8-Aug-08 11:43 
AnswerRe: C++ Lat and Long distance question Pin
Perspx8-Aug-08 12:32
Perspx8-Aug-08 12:32 
After some dabbling in my C IDE, I have come up with this to split the string up and put the lat/longitudes in an array:

char text[] = "San Francisco 37:47:48n 122:24:57n Honolulu 21:16:25n 157:49:13w";
char *input = (char *)text;
char **data = NULL;
char *ptr = NULL;

int i, datacount=0, curr=0, len;

for(i=0;i<(strlen(input)+1);++i) {
  if(input[i]==' '||input[i] == '\0') {
		len = (i-curr)-1; //-1 to strip the n, s, e or w.

		ptr = input+curr;

		if((ptr[0]>('0'-1))&&(ptr[0]<('9'+1)))  //Is the first character a number? If so it is the data
	  {
			datacount++;
			data = realloc(data, (datacount+1)*sizeof(char *));  //Allocate space for this data

		  data[datacount]=(char *)malloc(len);
		  strncpy(data[datacount], input+curr, len);
		  data[datacount][len]='\0';
	  }

    curr = (i+1);
	}
}


You can do something similar to split the numbers with the colons - the atoi() reference is here.

Hope this helps!
--Perspx

"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia

Introduction to Object-Oriented JavaScript

GeneralRe: C++ Lat and Long distance question Pin
winburn8-Aug-08 12:47
winburn8-Aug-08 12:47 
GeneralRe: C++ Lat and Long distance question Pin
Perspx8-Aug-08 12:50
Perspx8-Aug-08 12:50 
GeneralRe: C++ Lat and Long distance question Pin
winburn8-Aug-08 13:51
winburn8-Aug-08 13:51 
GeneralRe: C++ Lat and Long distance question Pin
Perspx8-Aug-08 14:14
Perspx8-Aug-08 14:14 
GeneralRe: C++ Lat and Long distance question Pin
winburn8-Aug-08 14:23
winburn8-Aug-08 14:23 
AnswerRe: C++ Lat and Long distance question Pin
Perspx8-Aug-08 22:50
Perspx8-Aug-08 22:50 
QuestionOpenGL and CScrollView Pin
godspeed1238-Aug-08 6:42
godspeed1238-Aug-08 6:42 
QuestionDynamic Buttons problem Pin
sabdalla808-Aug-08 6:07
sabdalla808-Aug-08 6:07 
QuestionCMFCOutlookBarTabCtrl redrawing issues Pin
roel_8-Aug-08 5:59
roel_8-Aug-08 5:59 
Questionstructure questions Pin
Dennis L8-Aug-08 4:43
Dennis L8-Aug-08 4:43 
QuestionRe: structure questions Pin
Matthew Faithfull8-Aug-08 4:50
Matthew Faithfull8-Aug-08 4:50 
AnswerRe: structure questions Pin
Dennis L8-Aug-08 5:03
Dennis L8-Aug-08 5:03 
GeneralRe: structure questions Pin
Perspx8-Aug-08 5:09
Perspx8-Aug-08 5:09 
GeneralRe: structure questions Pin
Matthew Faithfull8-Aug-08 5:11
Matthew Faithfull8-Aug-08 5:11 
GeneralRe: structure questions Pin
Dennis L8-Aug-08 5:21
Dennis L8-Aug-08 5:21 
AnswerRe: structure questions Pin
Matthew Faithfull8-Aug-08 5:30
Matthew Faithfull8-Aug-08 5:30 
GeneralRe: structure questions Pin
Dennis L8-Aug-08 5:39
Dennis L8-Aug-08 5:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.