Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing C/C++ to efficiently de-serialize a string comprised of floats, tokens and blank lines
    primarykey
    data
    text
    <p>I have large strings that resemble the following...</p> <pre> some_text_token 24.325973 -20.638823 -1.964366 0.753947 -1.290811 -3.547422 0.813014 -3.547227 0.472015 3.723311 -0.719116 3.676793 other_text_token 24.325973 20.638823 -1.964366 0.753947 -1.290811 -3.547422 -1.996611 -2.877422 0.813014 -3.547227 1.632365 2.083673 0.472015 3.723311 -0.719116 3.676793 ... </pre> <p>...from which I'm trying to efficiently, and in the interleaved sequence they appear in the string, grab...</p> <ol> <li>the text tokens </li> <li>the float values </li> <li>the blank lines </li> </ol> <p>...but I'm having trouble.</p> <p>I've tried strtod and successfully grabbed the floats from the string, but I can't seem to get a loop using strtod to report back to me the interleaved text tokens and blank lines. I'm not 100% confident strtod is the "right track" given the interleaved tokens and blank lines that I'm also interested in. </p> <p>The tokens and blank lines are present in the string to give context to the floats so my program knows what the float values occurring after each token are to be used for, but strtod seems more geared, understandably, toward just reporting back floats it encounters in a string without regard for silly things like blank lines or tokens. </p> <p>I know this isn't very hard conceptually, but being relatively new to C/C++ I'm having trouble judging what language features I should focus on to take best advantage of the efficiency C/C++ can bring to bear on this problem. </p> <p>Any pointers? I'm very interested in <em>why</em> various approaches function more or less efficiently. Thanks!!!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload