Delimiting problems
From: Ess355 (ess355_at_hotmail.com)
Date: 03/31/04
- Next message: Alexander Bartolich: "Re: Delimiting problems"
- Previous message: Dan Pop: "Re: how to define memory position and assign number...."
- Next in thread: Alexander Bartolich: "Re: Delimiting problems"
- Reply: Alexander Bartolich: "Re: Delimiting problems"
- Reply: pete: "Re: Delimiting problems"
- Reply: Mike Wahler: "Re: Delimiting problems"
- Reply: Malcolm: "Re: Delimiting problems"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 Mar 2004 08:43:06 -0800
Hello all,
I've got a simple problem and a harder problem. Simple one first:
1) I can't get the character " and as a delimiter.
Here is what I have:
...
const char delimiters[] = " .,;:!,\r\n\t()";
...
currentword = strtok(string, delimiters);
I've tried putting the " character in two ' characters to delimit the
" character, but the compiler throws it out:
const char delimiters[] = " .,;:!,\r\n\t()'"'";
So how can I delimit the " character?
2) I'm trying to count the number of words and letters from a text
file. Now when I have a piece of string such as
government's
I don't want the ‘ character because I'm using the strlen() function
count the number of words only. If I delimit the ' character then the
string gets split in two and the s on the end of the string becomes a
separate word, i.e.
government s
So instead of counting one word, I‘ll count 2, which of course is
inaccurate of my program.
How can I get round these problems?
Thanks in advance :-)
Ess
PS: And just for experimenting purposes:
3) I want to filter out some words, this method doesn't seem to work,
even though it compiles alright:
...
c = fgetc (TextFile);
if (c=!('!'||' '||'.'||'\0')) n++;
...
I am try to avoid the characters .! etc. The program hangs when I try
it.
However when I tried this, it worked.
...
c = fgetc (TextFile);
if (c==A) n++;
...
Which would count the number of A's in the string.
I'm confused :-)
- Next message: Alexander Bartolich: "Re: Delimiting problems"
- Previous message: Dan Pop: "Re: how to define memory position and assign number...."
- Next in thread: Alexander Bartolich: "Re: Delimiting problems"
- Reply: Alexander Bartolich: "Re: Delimiting problems"
- Reply: pete: "Re: Delimiting problems"
- Reply: Mike Wahler: "Re: Delimiting problems"
- Reply: Malcolm: "Re: Delimiting problems"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|