- Joined
- Jun 27, 2010
- Messages
- 53
- Reaction score
- 66
Hi, this is a simple tut how to read string with spaces...
Example:
Solution:
By using this, scanf will read whole string until end of line or when tab seperation will detected...
You can experiment by changing [^\t] to [^ ], etc..
Example:
Code:
12 02 2012 16 02 0 Server Powered by LOL!
Solution:
PHP:
sscanf(this->CurrentLineString, "%d %d %d %d %d %d %[^\t]s",&this->NewsSystemList[this->NewsCount].Day,
&this->NewsSystemList[this->NewsCount].Month,
&this->NewsSystemList[this->NewsCount].Year,
&this->NewsSystemList[this->NewsCount].Hour,
&this->NewsSystemList[this->NewsCount].Minute,
&this->NewsSystemList[this->NewsCount].Type,
&this->NewsSystemList[this->NewsCount].Line);
Code:
%[^\t]s
You can experiment by changing [^\t] to [^ ], etc..