|
somehow you retrieve the word and put it in stemp then,
while(..)
{
bool bValid = true;
for (j = 0; j < wsize; j++)
{
if (!(((stemp[0] >= 65) && (stemp[0] <= 90)) ||
((stemp[0] >= 97) && (stemp[0] <= 122))))
{
bValid = false;
break;
}
}
if (bValid)
FMap[stemp] = offset;
}
Do your Duty and Don't expect the Result Rate this Post, if I helped You
|
|
|
|
|
Hi Appu,,
Thank you very much, code is working i made the changes as below
while(!fin.eof())<br />
{<br />
fin >> word; <br />
wsize = strlen(word);<br />
offset=fin.tellg(); <br />
offset = offset - wsize + 1;<br />
stemp = word;<br />
<br />
bool bValid = true;<br />
<br />
for (int j = 0; j < wsize; j++)<br />
{<br />
if (!isalpha(stemp[j]))<br />
{<br />
bValid = false;<br />
break;<br />
}<br />
}<br />
<br />
if (bValid)<br />
FMap[stemp] = offset;<br />
}
|
|
|
|
|
Parthi_Appu wrote: May be influenced by the subject line...
might be. many people get influenced by subject line
|
|
|
|
|
toxcct wrote: why bothering comparing to ascii values, when you can use the characters literal ?
And why to make these comparisons, if isaplha[^] is available ?
|
|
|
|
|
prasad_som wrote: And why to make these comparisons, if isaplha[^] is available ?
yes, i totally agree, i was just beating a bit the worst code author
|
|
|
|
|
.
I guess, OP's query is still unsolved. I totally lost him.
|
|
|
|
|
Hi Prasad,
Thank you very much for the help. i made changes a below and its working now perfectly.
i had never used isalpha so i was with ascii code, thanks for the info.
while(!fin.eof())<br />
{<br />
fin >> word; <br />
wsize = strlen(word);<br />
offset=fin.tellg(); <br />
offset = offset - wsize + 1;<br />
stemp = word;<br />
<br />
bool bValid = true;<br />
<br />
for (int j = 0; j < wsize; j++)<br />
{<br />
if (!isalpha(stemp[j]))<br />
{<br />
bValid = false;<br />
break;<br />
}<br />
}<br />
<br />
if (bValid)<br />
FMap[stemp] = offset;<br />
}
|
|
|
|
|
Suresh H wrote: for(int j =0; j<=wsize; j++)
{
One correction need to be done here, It should be modified to,
for(int j =0; j < wsize; j++) .
And use isalpha to identify character.
You code should look like this,
for(int j =0; j < wsize; j++)
{
if (isalpha(stemp[j]))
{
FMap[stemp] = offset;
}
}
|
|
|
|
|
Hi Prasad,
Code as no effect its adding all the words.
<br />
<br />
void getoff(char *fname)<br />
{<br />
ifstream fin;<br />
fin.open(fname,ios::in);<br />
<br />
<br />
int wsize;<br />
string stemp;<br />
<br />
while(!fin.eof())<br />
{<br />
fin >> word; <br />
strlwr(word);<br />
wsize = strlen(word);<br />
offset=fin.tellg(); <br />
offset = offset - wsize + 1;<br />
stemp = word;<br />
<br />
for(int j =0; j < wsize; j++)<br />
{<br />
if (isalpha(stemp[j]))<br />
{<br />
FMap[stemp] = offset;<br />
}<br />
}<br />
}<br />
<br />
fin.close();<br />
}<br />
|
|
|
|
|
Here change the for loop as below,
int nIndex = 0;
for (int j = 0; j < wsize; j++)
{
if (isalpha(stemp[j]))
{
FMap[nIndex++] = stemp[j];
}
}
FMap[nIndex] = '\0';
Do your Duty and Don't expect the Result Rate this Post, if I helped You
|
|
|
|
|
Look carefully at
for(int j =0; j < wsize; j++)
{
if (isalpha(stemp[j]))
{
FMap[stemp] = offset;
}
}
Do you really want to add an entry to FMap every time you find an alpha character, or everytime you find a word with ALL the characters alpha?
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
cp9876 wrote: if (isalpha(stemp[j]))
humm!
|
|
|
|
|
Use _isascii
Come online at:-
jubinc@skype
|
|
|
|
|
Don Box wrote: _isascii
OP wanted to know if given character is in range a-z or A-Z . I wonder, why you have suggested this function ?
|
|
|
|
|
I had placed this question already
But didnt get any answer.
Please give some solution fast
hopefullyyyyyyyyyyyyyyyyyyy
shyam
|
|
|
|
|
sanjay kaledhonkar wrote:But didnt get any answer.
Please give some solution fast
hopefullyyyyyyyyyyyyyyyyyyy
what you want actual Lan Speed which can be easily found out by using GetIpStatisticsEx and if you want LanSpeed printed on LanCard .. i soubt you have to use WMI
|
|
|
|
|
Thanks is in order: sanjay kaledhonkar
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
Programm3r wrote: Thanks is in order:
sanjay kaledhonkar
didn't understand what you want to say .. bro!
|
|
|
|
|
sanjay kaledhonkar wrote: getting LAN speed
You need to know the engine type of your LAN. If you are planning to increase the speed, use a High octane fuel. Tubeless radials will be an added advantage. If I were you, I would not mind spending a little more to get a couple of nitrogen boosters fixed to boost the speed. And you obviously need a speedometer LanoMeter to check the LAN speed. It is available in all leading automobile LanoMobile stores. See you at the international lan race at Tokyo. Bye for now.
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
brahmma wrote: use a High octane fuel.
thats little but costly.. don't you think... but i like lanometer concept.. let make gui for same.. what do you say!
|
|
|
|
|
ThatsAlok wrote: but i like lanometer concept.. let make gui for same.. what do you say!
that is good. Shall we work together and write an article? Lanometer?
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
brahmma wrote: that is good. Shall we work together and write an article? Lanometer?
offcourse.. great Idea!
|
|
|
|
|
Hello,
i have an application in which i use a mysql-database.
the connection is done with the mysqlpp-api.
if i compile (visual studio 2005) the programm in debug mode everything works fine but if i compile the programm in release mode then the programm aborts when trying to create mysqlpp::Query object.
( mysqlpp::Query test = connection.query(); or mysqlpp::Query *test = new Query(connection); )
i get an access violation at adresss null.
i tried to disable all the optimizations in the release configuration. but it does not help.
could it be that i have to allocate extra memory befor trying to create an object?
is it possible to allocate initial e.g. 30mb of memory?
and if yes how?
thanks
|
|
|
|
|
There are different possibilities for this. I suggest you to read this[^] article by Joseph M. Newcomer .
|
|
|
|
|
tiflo wrote: is it possible to allocate initial e.g. 30mb of memory?
30 mb of memory.. he he he.. why do you need so large amount of memory
|
|
|
|