Click here to Skip to main content
15,895,370 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: WS_TABSTOP Pin
Stephen Hewitt9-Dec-11 21:22
Stephen Hewitt9-Dec-11 21:22 
AnswerIt works, now but how to detect shift tab << Pin
jkirkerx8-Dec-11 12:40
professionaljkirkerx8-Dec-11 12:40 
GeneralRe: It works, now but how to detect shift tab << Pin
Graham Breach8-Dec-11 13:06
Graham Breach8-Dec-11 13:06 
GeneralRoom for improvement let me know. Pin
jkirkerx8-Dec-11 13:16
professionaljkirkerx8-Dec-11 13:16 
QuestionParsing in C Pin
Software20077-Dec-11 6:55
Software20077-Dec-11 6:55 
AnswerRe: Parsing in C Pin
Albert Holguin7-Dec-11 7:23
professionalAlbert Holguin7-Dec-11 7:23 
AnswerRe: Parsing in C Pin
Chris Losinger7-Dec-11 8:10
professionalChris Losinger7-Dec-11 8:10 
GeneralRe: Parsing in C Pin
Software20077-Dec-11 9:54
Software20077-Dec-11 9:54 
Fantastic! I did get it to work with very minor modifications.
C++
typedef struct item_t
{
   char d[8192];
   char n[8192];
   char i[8192];
} item;

char *consume_between_parens(char *p, char *out)
{
   p++;   //advance to where we think there is '('

   if (*p!='(') return NULL; // error

   int paren_count = 1;

   p++;
   while (*p)
   {
	   if (*p=='(') 
          paren_count++;

       if (*p==')') 
          paren_count--;

	   if(!paren_count) //done
		   break;

       *out = *p; // copy
       out++; p++; // next
   }
 
   return p;
}


void parse(char *p)
{

  item * curItem = NULL;
 
  while (*p)
  {

            if (*p=='d')
            {
                curItem = (item*)malloc(sizeof(item));
                p = consume_between_parens(p, curItem->d);
            }
            if (*p=='n')
            {
                p = consume_between_parens(p, curItem->n);
            }
            if (*p=='i')
            {
                p = consume_between_parens(p, curItem->i);
               // addToArray(array, curItem);
            }

     p++;
  }

}

int _tmain(int argc, _TCHAR* argv[])
{
	char *text ="1:7\22\\d(2011)n(0)i(711910)d(2010)n(1)i(711911)";

	parse(text);

	return 0;
}

QuestionRe: Parsing in C Pin
David Crow7-Dec-11 9:27
David Crow7-Dec-11 9:27 
AnswerRe: Parsing in C Pin
Software200710-Dec-11 13:28
Software200710-Dec-11 13:28 
AnswerRe: Parsing in C Pin
Software200712-Dec-11 5:52
Software200712-Dec-11 5:52 
AnswerRe: Parsing in C Pin
David Crow12-Dec-11 7:15
David Crow12-Dec-11 7:15 
GeneralRe: Parsing in C Pin
Software200712-Dec-11 7:32
Software200712-Dec-11 7:32 
SuggestionRe: Parsing in C Pin
David Crow12-Dec-11 8:34
David Crow12-Dec-11 8:34 
GeneralRe: Parsing in C Pin
Software200712-Dec-11 9:36
Software200712-Dec-11 9:36 
QuestionDouble value precision Pin
mutpan6-Dec-11 18:54
mutpan6-Dec-11 18:54 
AnswerRe: Double value precision Pin
Chandrasekharan P6-Dec-11 19:27
Chandrasekharan P6-Dec-11 19:27 
GeneralRe: Double value precision Pin
mutpan6-Dec-11 19:35
mutpan6-Dec-11 19:35 
GeneralRe: Double value precision Pin
Chandrasekharan P6-Dec-11 20:33
Chandrasekharan P6-Dec-11 20:33 
AnswerRe: Double value precision Pin
CPallini6-Dec-11 22:13
mveCPallini6-Dec-11 22:13 
GeneralRe: Double value precision Pin
Albert Holguin7-Dec-11 3:24
professionalAlbert Holguin7-Dec-11 3:24 
AnswerRe: Double value precision Pin
tssutha036-Dec-11 22:30
tssutha036-Dec-11 22:30 
AnswerRe: Double value precision Pin
Chuck O'Toole7-Dec-11 5:03
Chuck O'Toole7-Dec-11 5:03 
AnswerRe: Double value precision Pin
JackDingler9-Dec-11 9:30
JackDingler9-Dec-11 9:30 
AnswerRe: Double value precision Pin
Chuck O'Toole9-Dec-11 10:38
Chuck O'Toole9-Dec-11 10:38 

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.