Get Text Body C
How can I get the text body in a string ?
From username@localhost Fri May 13 12:28:30 2010
Return-Path: <username@localhost>
X-Original-To: recipe@localhost
Delivered-To: recipe@localhost
Received: from cristi?localhost (localhost [127.0.0.1])
by Notebook (Postfix) with SMTP id 50F6F809E0
for <test@localhost>; Fri, 13 May 2010 12:28:30 +0300 (EEST)
Message-Id: <20110513092830.50F6F809E0@Cristi-Notebook>
Date: Fri, 13 M开发者_JAVA百科ay 2010 12:28:30 +0300 (EEST)
From: username@localhost
To: undisclosed-recipients:;
Text Body
.
Various forms of doing that, but if that string is always formated that way, you could read the string comparing the current character being processed with the last one, until you find them both to be '\n' (new line identifier).
That could work because, if the format is always the same, you should have:
To: undisclosed-recipients:;
Text Body
.
What can be read as:
To: undisclosed-recipients:;\n
\n
Text Body\n
\n
.
The first pair will indicate the start of the body as the next character. The last (not the next, the last) followed by a point will indicate the end of the body.
Note: As I said before, it's just one way of doing that, and since you tagged it C, I know it won't be an issue to work with character reading in C. :)
Hope that helps.
精彩评论