On Aug 20, 4:05 pm, Fred <fr*****************@boeing.comwrote:
On Aug 20, 12:33 pm, Stuudent <wojtek.jurkowlan...@gmail.comwrote:
Hi!
Is there possibility to read char* table word by word in C (not C++)?
I'm learning C by writing simple HTTP Server on BSD sockets (just for
fun). And I want to read info from HTTP header received from client. I
get char table, and I have to read some information.
Can you help me?
I can post the whole code of server when I finish.
First you have to define what you want "word" to mean.
Actually, HTTP already defines it. If you want to parse the request
line, for example, it's easy, since the three items are separated by
spaces. HTTP defines it as
Request-Line = Method SP Request-URI SP HTTP-Version CRLF
(Where SP means a space character, and CRLF means the sequence "\r\n"
in C.) See RFC 2616 for further details.
With this in mind, you can either parse it with strtok(), or simply go
through the buffer examining character by character.
<snip>
Sebastian