473,473 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 2961
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.