[Interest] question about string to C array/struct in Qt
Vincent Cai
wcai at cypress.com
Sat Feb 2 09:02:40 CET 2013
Dear,
I have a log file which contains logged data and report.
In Qt project, I need to parse the log file and collect the data and report.
The collected data will then be assigned to an C array and structure.
This seems to be complicated for me due to lack experience on Qt String class.
Could anybody guide me some reference code or document?
Thanks a lot,
Vincent.
Below is an example of the log file content.
***************************FrameCounter: 138
Data Begin
/* 0 1 2 3 4 5 6 7 8 9 10 11 */
/* 0*/ 0, 0, -1, 0, 1, -2, 4, 0, -1, 4, 0, -5,
/* 1*/ 1, -1, 6, 2, 2, 0, 1, -3, -2, 3, 0, -2,
/* 2*/ 1, 1, 5, 2, 4, 2, 1, 5, -1, -2, -2, -4,
/* 3*/ 1, -16, -46, -87, -99, -48, -5, 6, 4, -10, 1, 1,
/* 4*/ 21, -2, -1, -3, -27, -12, -3, 8, -1, -5, -4, 1,
/* 5*/ 66, 213, 120, 38, -1, -9, -10, -7, -15, -13, -4, 1,
/* 6*/ 308, 1847, 921, 32, -1, -2, -45, -88, -102, -76, -3, 1,
/* 7*/ 137, 1263, 674, 31, -8, -1, -24, -58, -87, -77, -15, 1,
/* 8*/ 5, 39, 42, 25, -17, 1, -1, -26, -35, -42, -19, 0,
/* 9*/ -7, -10, 4, -2, -24, 2, 44, 53, 7, -2, -10, -7,
/*10*/ -35, -78, -97, -58, -57, 1, 672, 1250, 150, -21, -31, -27,
/*11*/ -37, -122, -127, -132, 0, 4, 972, 1659, 224, -24, -13, -27,
/*12*/ -1, -14, -14, -28, -28, 30, 80, 150, 53, 18, -19, -32,
/*13*/ -1, 34, 738, 516, -22, 13, 1, -6, 152, 120, -1, -25,
/*14*/ -15, 118, 1761, 1137, 35, 1, -87, -55, 1593, 1082, -1, -22,
/*15*/ 1, 2, 341, 229, 15, 1, -27, -5, 839, 685, 4, 0,
/*16*/ 4, 1, -1, -21, -32, -19, -13, -15, 27, 2, -34, -3,
/*17*/ 2, -1, -19, -62, -81, -49, -7, -1, -1, -43, -46, -1,
/*18*/ 1, 13, 5, -18, -57, -49, -13, 3, 11, -19, -37, -3,
/*19*/ 4, 12, 18, -1, -32, -33, -1, 11, 16, 8, 1, 3,
/*20*/ 0, 5, 18, 3, -13, -16, 1, 11, 14, 9, 5, 1,
/*21*/ 2, 13, 26, 12, 2, -3, 3, 8, 15, 7, 3, 1,
Data End
Report Begin
TouchNum = 4
Unit[0].x = 109
Unit[0].y = 148
Unit[0].Flag = 0
Unit[0].Id = 0
Unit[0].z = 255
Unit[0].Type = 152
Unit[1].x = 452
Unit[1].y = 242
Unit[1].Flag = 0
Unit[1].Id = 3
Unit[1].z = 255
Unit[1].Type = 152
Unit[2].x = 179
Unit[2].y = 313
Unit[2].Flag = 0
Unit[2].Id = 2
Unit[2].z = 255
Unit[2].Type = 152
Unit[3].x = 557
Unit[3].y = 322
Unit[3].Flag = 0
Unit[3].Id = 1
Unit[3].z = 255
Unit[3].Type = 152
Report End
This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130202/511e2811/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: logData.c
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130202/511e2811/attachment.c>
More information about the Interest
mailing list