expected expression before ‘{‘ token

The error is because you can’t assign an array that way, that only works to initialize it. So applying this to your specific example: or you could use memset the same way, but instead of sizeof(int) you need size of your structure. That doesn’t always work… but given your structure, it will.

Parse (split) a string in C++ using string delimiter (standard C++)

You can use the std::string::find() function to find the position of your string delimiter, then use std::string::substr() to get a token. Example: The find(const string& str, size_t pos = 0) function returns the position of the first occurrence of str in the string, or npos if the string is not found. The substr(size_t pos = 0, size_t n = npos) function returns a substring of the object, …

Read more