|
|
Hi to All,
I have used the find() function of string lib in my program.
Now my problem is I need to search for case insensitive sub string.
Please help me to convert my code .
My code sample is.........
string::size_type loc=Myword.find("TaG"); //searching if tag/Tag/tAg...is present in the string
if(loc!= string::npos)
{
//tag is present
}
else
{
//"tag absent";
}
thanks in advance
HimangshuS
-----------------------------
I am a beginner
|
|
|
|
|
You have two options
Override your own string type that's case insensitive:
Clicky[^]
Or just make lower case copies of the string and substring, and use find with those.
|
|
|
|
|
is there any function to make the string lowercase before comparing..say
string a="HI How R U"
if(a.find("hi")) //here I want to convert the string into lowercase n compare with lowercase hi
{
cout<<"found";
}
thanks
-----------------------------
I am a beginner
|
|
|
|
|
You can maybe try this function StrStrI . It's takes two buffers look up MSDN. So when you call this function pass in std::string likewise...
StrStrI( &Myword[0], "TaG" );
If successfull it will return address of the substring, else NULL.
Header to include: Declared in Shlwapi.h.
Import Library: Shlwapi.lib.
Also make sure you don't modify the length of Myword buffer. std::string is not aware of any such updates.
|
|
|
|
|
thanks for your reply...
Actually if you dont mind I need little more clearence.
I didnot get how do I use strstrI in the same line
if(myword.find("Tag")!= string::npos)
All we need is to incorporate case insensitive search in the same statement above.
(Or can we pass the lowercase of myword itself so that we can check with "tag" always)...something like
if(lcase(myword).find("Tag")!= string::npos)
myword is of the type string
thanks in advance
-----------------------------
I am a beginner
|
|
|
|
|
himangshuS wrote: if(myword.find("Tag")!= string::npos)
Like this...
if( StrStrI( &Myword[0], "Tag" ))
{
MessageBox( "Found \"Tag\" in Myword :)" );
}
|
|
|
|
|
hi all,
i have a problem with font of a CStatic, CEdit,CRichEdit Control Acctually problem is nothing but when i create a control using drag and Drop from contrl box the control text/Caption is looks like normal, and when i create it dynamically using Create function it looks like it is bold.
so how to change dynamically created control's text normal.
|
|
|
|
|
Hello everybody,
does exist a handler which indicates the end of the maximization code?
Because if I maximize the MDI-Frame i step 4 times into the OnSize Handler of the Frame and its View.
Each time the View is calculated at new, which provokes a ugly effect (+- flickering)
If I get the OnSize Handler for maximization, i could freeze the View or Screen. And after the last OnSize i release the Screen.
But I don't find a way to detect the end of this maximizing process.
Is there already a technique to work arround?
Big thanks for any help 
|
|
|
|
|
Hi all,
I am trying to extend a NTFS partition using FSCTL_EXTEND_VOLUME. The code is
HANDLE hVolume = CreateFile(L"\\\\.\\E:", GENERIC_READ | GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,NULL,OPEN_EXISTING,0,NULL);
LONGLONG liBuffer = 20971520; // size in sectors to be increase
DWORD dwReturnedBytes = NULL;
DeviceIoControl(hVolume,FSCTL_EXTEND_VOLUME,&liBuffer,sizeof(liBuffer),NULL,0,dwReturnedBytes,NULL);
But the function fail with #error 87.
Someone please help me out with your suggestions.
Thanks.
|
|
|
|
|
Madan Chauhan wrote: But the function fail with #error 87.
FormatMessage()[^] says: "The parameter is incorrect". So, you could check if all the parameters are valid before you pass it to the function.
You could as well use the Error lookup utility which comes with VS to get the error description for an error number.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Thanks for the reply.
Yes all the parameters are correct. Is there some extra job need to do before executing this function?
|
|
|
|
|
Hi Madan Chauhan,
Only FSCTL_EXTEND_VOLUME is not sufficient to extend any NTFS volume. You need to first extend its boundry then use this control code.
thanks
CmyLife 
|
|
|
|
|
Thanks for your guidance.
I dont have any idea which API or function extend the boundary of partition.
Please tell me if you know that one.
thanks.
|
|
|
|
|
|
Thanks for ur support CmyLife I done it.
|
|
|
|
|
Hey madan tats gud.I did this same thing few years back, anyways enjoy.

|
|
|
|
|
Hi all,
I'm having an application for Remote control, but there are some problems in its part of network connections.I have tried for weeks, still can't find out the reason for that.
In our program, we don't use thread synchronization in function "TCPSock->Recv"(winsock api recv() is used in it), because this function is only used in single thread. Today, I tried to add thread synchronization to this function.As a result, these network connections problems are fixed(at least it seems to be).
My question is, "Is thread synchronization needed when only using a function in single thread?"
Regards,
HQ
|
|
|
|
|
hanq_38910130 wrote: "Is thread synchronization needed when only using a function in single thread?"
It is actually the other way round. If you are using multiple threads, then you try to synchronize access to the code that must be protected from multiple simultaneous accesses.
Or is that you are referring to an additional worker thread (other than the application's main thread) while saying a "Single thread"?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Thanks for your replay
Yes, I mean "an additional worker thread" when I say "a single thread".
Our program mainly has two parts, server and client.
server accepts connections from client, when a connection is accepted, it creates a "worker thread" to communicate with the client. Only in this thread, "TCPSock->Recv()" will be called, so originally we don't use a "Thread Synchronization". But today, I Added "Thread Synchronization", and the bugs seem to be fixed, so I want to know "Is Thread Synchronization needed in single thread in some conditions?"
Thanks very much 
|
|
|
|
|
hanq_38910130 wrote: But today, I Added "Thread Synchronization", and the bugs seem to be fixed
Glad about that.
hanq_38910130 wrote: "Is Thread Synchronization needed in single thread in some conditions?"
But, I still am not able to understand this. If it is just one thread accessing the code that must be 'protected', then it does not matter how many other threads are running simultaneously. But if more than one thread can possibly access the code that must be protected, then you need synchronization. I hope I am clear.
There is a whole lot of information on this topic here[^] if you would like to read up.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Thanks for your help.
I will look into the linking which you provided to see if there can be any useful information.
Add maybe the reason that causes all these problems exist in some other code, anyway I will check this. 
|
|
|
|
|
Hi...
[ImageProcessing]My doubt is how to extract text from the image..before extraction we need to segment properly....
|
|
|
|
|
Stop spamming the site with your meaningless posts.
Read the guidelines[^] before posting anything more.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|