S
Sean Bartholomew
i am trying to parse.....:
ifstream newFans ("/Volumes/iBook
Apps/Users/me/Library/Mail/[email protected]/INBOX.mbox/mbox",
ios::in|ios::binary|ios::ate);
so that i could create a tab delimited text file with the fields
filled out from an online form that is sent to my email address.
i used the find all command in BBEdit and found that "\rFirst Name"
accurately located all instances (and no other) of the 1st field in
each email.
good.
so im trying to use strstr() to find the 1st occurance of that string
in the buffer that contains the entire file then parse for consecutive
'\r''s for 14 fields. then i have to go look for the next "\rFirst
Name" and repeat until eof.
even for just the 1st batch of fields it writes a blank text file.
//skip to first record
char *start, *end, *tempBuf;
start = strstr(buffer, "Subject: ");
if (start != 0)
{
end = strchr(start, '\r');
if (end != 0)
{
tempBuf = (char*)malloc(end - start + 1);
strncpy(tempBuf, start, end - start);
tempBuf[end - start] = '\0';
}
}
ofstream testText ("filepath/testText.txt");
testText << tempBuf;
testText.close();
ifstream newFans ("/Volumes/iBook
Apps/Users/me/Library/Mail/[email protected]/INBOX.mbox/mbox",
ios::in|ios::binary|ios::ate);
so that i could create a tab delimited text file with the fields
filled out from an online form that is sent to my email address.
i used the find all command in BBEdit and found that "\rFirst Name"
accurately located all instances (and no other) of the 1st field in
each email.
good.
so im trying to use strstr() to find the 1st occurance of that string
in the buffer that contains the entire file then parse for consecutive
'\r''s for 14 fields. then i have to go look for the next "\rFirst
Name" and repeat until eof.
even for just the 1st batch of fields it writes a blank text file.
//skip to first record
char *start, *end, *tempBuf;
start = strstr(buffer, "Subject: ");
if (start != 0)
{
end = strchr(start, '\r');
if (end != 0)
{
tempBuf = (char*)malloc(end - start + 1);
strncpy(tempBuf, start, end - start);
tempBuf[end - start] = '\0';
}
}
ofstream testText ("filepath/testText.txt");
testText << tempBuf;
testText.close();