Hi All
I have a very tricky problem, not able to solve it. Hence asking this question.
I have a code portion like this -
int
parse_msg(in_buf,line1,line2,sccs_line)
char in_buf[MAX_5E_MSG_LEN];
char line1[SCCS_LINE_LEN];
char line2[SCCS_LINE_LEN];
char sccs_line[SCCS_LINE_LEN];
{
....
(void)fprintf(trace_fp,"parse_msg1 in_buf = %s \n", in_buf);
/* separate in_buf into separate lines. */
sscanf(in_buf,"%*d\t%[^\t]",tmp_buf);
(void)fprintf(trace_fp,"parse_msg1 tmp_buf = %s \n", tmp_buf);
....
}
The argument in_buf comes from external system and we don't know the exact format. But the trace files shows -
parse_msg1 in_buf = 99
S570-262205 14-03-17 10:58:18 428064 RCVY SLKCUTMA06T
M RCV SUCCESS REQVT INSERTED 010 1 0 2 1 5 4 LOGIN = RCOS1
parse_msg1 tmp_buf = S570-262205 14-03-17 10:58:18 428064 RCVY SLKCUTMA06T
M RCV SUCCESS REQVT INSERTED 010 1 0 2 1 5 4 LOGIN = RCOS1
So the question is how I can write my own example code and prepare the in_buf variable so that I can pass it to this parse_msg() function? What do I mean is that I will write a main() function and prepare the in_buf string and pass it to the parse_msg() function. Since parse_msg() function has the following line -
sscanf(in_buf,"%*d\t%[^\t]",tmp_buf);
, how I can prepare the in_buf string?
Thanks in advance for any help.
Cheers.