|
So, does that mean that whenever i need to send a message, i need to raise a flag and then in OnSend() send the message only when that flag is set ?
Is it the way it is done in standard programs.
Please help.
thanks in advance.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
Yes, you are right on both accounts.
There are numerous code examples here to help.
Brian
|
|
|
|
|
Hi
i want to validate the matching comments.(/* */).Every file should start with the /* and should end with */.
if he gives multiple comments it sholud not be validate.
Here iam showing some possible example which user may enter.
1./*text*//*
2./*text*/*/
3./*text/**/
but that should be only /*text*/.other than this situation i need to throw an error.he is entering the file in edit box.
please any one can give me the solution for this problem.
|
|
|
|
|
Load the file into memory and use the boost::RegEx class to validate it. For more information, check out boost.org.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
hint : use a stack when scanning the file.
|
|
|
|
|
Search for '/*' in the file. It should be found only once and the offset should be 0.
Then search for '*/' in the file. Again this should be found only once and offset should be at end of file.
reddy harish wrote: he is entering the file in edit box
I assumed you have access to the file contents in a string so you can use string::find
----------------------
Mayank Thakore
Learning C++ - since 1998
They didn't print my card right; so I resigned.
|
|
|
|
|
I dont think that it would require any special programming.
Whenever you get a /*, you will have to search for a */.
If you get any /* nested inside a /*, then you will have to ignore it.
Set a flag to indicate that you have already got a /*, then ignore subsequent /* while the flag is on. When you get a */, just put off the flag and consider the whole part as a commented area.
Hope it helps.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
I don't think it will be quite that simple. For example what happens if a "//", "/*" or "*/" is inside quotes?
Steve
|
|
|
|
|
well, steve, what i suggested was the simplest way and the basic algorithm.
If the need of checking inside strings is required, then it could very well be checked too.
There could be several other requirements too. All of them could be simply built over that basic algo.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
Is there an explaination to how to hook socket?
thanks in advance!
|
|
|
|
|
See here[^] maybe it is some helpful to you
|
|
|
|
|
Is it possible to add and remove strings from the stringtable at runtime? Or even better create a new stringtable and add it to the list of stringtables at runtime.
Thanks
|
|
|
|
|
ABuenger wrote: Is it possible to add and remove strings from the stringtable at runtime?
No. The string table is a static resource. What you can do is write your own LoadString method to look in the string table and then in whatever other locations you want to check.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
e.g. how to write a string "sample string" to a txt file whose full name is "C:\a.txt"?
this must be a very simple question. so could anybody be so kind as to provide a little sample code?
by the way, if writing to a MS Excel file is as simple, I would rather learn how to write to a Excel file.
Thank you very much!!!
-------------------
I am learning C++ and English
|
|
|
|
|
char string[100]="hello";
FILE *p;
p=fopen("C:\a.txt","w");
fprintf(p,"sample string is : %s",string);
------------------------------------------
also you can see fprintf and it's examples in help .
|
|
|
|
|
this is enough ,thank you very much
|
|
|
|
|
as you use C++, use C++ 'til the end...
prefer std::fstream to manage files that the old C functions like fopen() and fprintf().
std::ofstream myFile("C:\\a.txt");
myFile << (LPCSTR)myCString;
myFile.close();
also, ,be careful when writing file paths... use the double \\ !!!
|
|
|
|
|
Thank you, I'll follow the rule in the future
|
|
|
|
|
ewighell wrote: if writing to a MS Excel file is as simple, I would rather learn how to write to a Excel file.
Its not as simple as writing to a text file, but you can find plenty of examples and documentation by googling for Excel Automation. I recommend being at least vaguely familiar with COM before trying to jump through the Office-Automation hoops, though.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Thank you very much!!!
I am happy that I have never planned to become a software engineering.
|
|
|
|
|
If you are using MFC then use the CStdioFile::WriteString method.
CStdioFile file;<br />
file.Open (...);<br />
file.WriteString (myString);<br />
file.Close ();
|
|
|
|
|
but it seems that I can only write strings in English into the file. it fails when it comes to Chinese characters.
by the way, UNICODE has been defined in my program.
does any body know why and how to fix it?
Thank you very much!!!
-------------------
I am learning C++ and English
|
|
|
|
|
You can use CFile with CArchive for wrote to txt file
|
|
|
|
|
Hello
I need to ask a Yes or No question in a message box . like
Application->MessageBoxA()
but with two buttons : Yes and No
I am working with Borland C++Builder.
thanks
|
|
|
|
|
Specify MB_YESNO for uType parameter of the MessageBox function. More info here[^]
|
|
|
|