Looking for algorithm that reverses the sprintf() function output

Question :

Looking for algorithm that reverses the sprintf() function output,

Answer :

I am working on a project that requires the parsing of log files. I am looking for a fast algorithm that would take groups messages like this:

The temperature at P1 is 35F.

The temperature at P1 is 40F.

The temperature at P3 is 35F.

Logger stopped.

Logger started.

The temperature at P1 is 40F.

and puts out something in the form of a printf():

"The temperature at P%d is %dF.", Int1, Int2"   {(1,35), (1, 40), (3, 35), (1,40)}  

The algorithm needs to be generic enough to recognize almost any data load in message groups.

Read More  Design Pattern for Undo Engine

I tried searching for this kind of technology, but I don’t even know the correct terms to search for.

,

I think you might be overlooking and missed fscanf() and sscanf(). Which are the opposite of fprintf() and sprintf().

That’s the answer Looking for algorithm that reverses the sprintf() function output, Hope this helps those looking for an answer. Then we suggest to do a search for the next question and find the answer only on our site.

Disclaimer :

The answers provided above are only to be used to guide the learning process. The questions above are open-ended questions, meaning that many answers are not fixed as above. I hope this article can be useful, Thank you

Read More  Is there any list datatype in MySQL stored procedures, or a way to emulate them?