|
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[^]
|
|
|
|
|
|
If you search for MessageBox on the msdn.microsoft.com website you will see that it takes four input parameters like this:
MessageBox(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType);
HWND is the window handle
lpText is the text that is going to ask the question
lpCaption is the title of the message box
uType is the type of box (for a yes/no box set it to MB_YESNO in visual studio)
make sure you include the required header file Windows.h for the defines
Chipper Martin
|
|
|
|
|
if(AfxMessageBox (_T("Question"),MB_YESNO)==IDYES)<br />
{<br />
}<br />
else<br />
{<br />
}
|
|
|
|
|
Hi,
Does anyone know of a free tool I can use to convert a binary data file into an array of literal hex values, so as to be able to embed the data of the file in my source code?
Joel Holdsworth
|
|
|
|
|
You'd be better off adding the binary data to the EXE as a resource and using the FindResource , LoadResource and LockResource functions to access it in place.
Steve
|
|
|
|
|
True enough... when you're windows programming, not working on an embedded system!
Joel Holdsworth
|
|
|
|
|
So you're not targeting Windows? If this is the case it would have been a good idea to mention this as this is a Windows programming site and unless otherwise informed people will assume you're programming for Windows.
If you're targeting Windows there will little difference. The data is the same size regardless. If you turn it into hex literals the compiler turns it back into raw data when it compiles it. If you attach it as a resource the actual raw data is in the EXE instead if the same data reconstructed by the compiler.
If you're not programming Windows your toolset and platform may well provide a similar feature.
Steve
|
|
|
|