Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parsing a string w/{ } Braces 1

Status
Not open for further replies.

alrozer

Programmer
Jan 25, 2001
1
US
I have an MFC application that querries an ODBC responder.
There is a particular set of messages which is unique to the system which are send to the server through the winsock to register and then to querry the ODBC. Once the application receives the data from the winsock control it is in a string which has to be parsed, right now I got the string separated by the "|"( that's the symbol that separates these messages). Then, the information from the ODBC comes in this format,
{ 1 1 administrator Default {} {} 0 {}}
I am having a hard time parsing the information
out of the curly braces. I was thinking of finding the position of the first "{" brace and then finding the position of the last "}" brace, and then extracting the content in between. If any of you guys have any suggestions, methods or any sample code wchich could help me out it would be great :) Thanks ;-)
 
to find whare an opened bracket closes you should use this method:

{0+1=1 tag1 opens with 0
{1+1=2 tag2 opens with1(first N1)
{2+1=3 tag3 opens with 2
}3-1=2 tag2 closes with 2
}2-1=1 tag2 opens with1(first N1)
{1+1=2 tag4 opens with1(second N1)

}2-1=1 tag4 closes with1(second N1)
}1-1-0 tag1 closes with0
if you get open with SomeNumber, you put into string variable all symbols until ClosesWithTheSameNumber. John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top