473,287 Members | 3,319 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Reading char* word by word

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.
Aug 20 '08 #1
5 2957
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.
For example, what is the second "word" in this line:
<BODY TEXT="#000000" BGCOLOR="#FFFFFF">
is it BODY, or TEXT, or TEXT="#000000", or something else?
if you want it to be TEXT, what is the next "word"?
Is it
="#000000"
or
#000000

--
Fred Kleinschmidt
Aug 20 '08 #2
On 20 Sie, 23:05, Fred <fred.l.kleinschm...@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.
For example, what is the second "word" in this line:
* *<BODY TEXT="#000000" BGCOLOR="#FFFFFF">
is it BODY, or TEXT, or TEXT="#000000", or something else?
if you want it to be TEXT, what is the next "word"?
Is it
* ="#000000"
or
#000000

--
Fred Kleinschmidt
Second word is ' TEXT="#000000 '
word separated by space or \n.
Aug 20 '08 #3
Stuudent wrote:
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?
You may look at the strtok function.
--
Pietro Cerutti
Aug 20 '08 #4
"Fred" <fr*****************@boeing.comwrote in message
news:bb**********************************@a3g2000p rm.googlegroups.com...
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.
For example, what is the second "word" in this line:
<BODY TEXT="#000000" BGCOLOR="#FFFFFF">
is it BODY, or TEXT, or TEXT="#000000", or something else?
Such as 0x444F?

(ascii OD as word)

Aug 21 '08 #5
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

Aug 21 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Phil Slater | last post by:
I'm trying to process a collection of text files, reading word by word. The program run hangs whenever it encounters a word with an accented letter (like rôle or passé) - ie something that's not a...
2
by: Eric Lilja | last post by:
Hello, I have a text file with following format: number one_word string number number char string There may be several lines of the last type (number number char string), the number of such...
1
by: Steve | last post by:
Typical story, I want to call an unmanaged c DLL from a c# app. I have most of the methods working, there is one that is stubborn. <c code> union DEVICE_T { /// this buffer holds the...
2
by: spidey12345 | last post by:
what i need this program to do is to read paragraphs like "st blah blh test ere se sit blha eere w" and then it will reformat to "st blah...
26
by: vlsidesign | last post by:
I am a newbie and going through "The C programming language" by Kernighan & Richie on my own time (I'm not a programmer but I want to learn because it can save me time in my normal job, and it is...
16
by: Jm.GlezdeRueda | last post by:
Hi all, Im trying to read a 24bit bmp with fread, and i have some problems.. I want to read the whole structure in one time, but i dont know why, it only reads the first member well.. I have...
8
by: Jay | last post by:
I'm trying to store a sequence of operations and values of different types into a single array. It's a sequence of command word bytes, and a sequence of one or more values (as determined by the...
2
by: ajay0419 | last post by:
Hi: I am trying to read from a file, which stores answers for a particular question(The answers are stop listed ). Each answer in the file is enclosed in opening and closing braces. Here is the...
24
by: arnuld | last post by:
I have a function named getword that read every single input from std. input. WHAT I WANTED: I want it read the word if it has less than or equal to 30 characters. Anything else beyond that...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.