|
Rakesh5 wrote: i am facing C4309 warning
Please, next time post the full error message, it would avoid people to have to google to know what it is exactly (we don't know all the error codes by heart you know).
Rakesh5 wrote: if (ws.ReverseFind( '>>' ) > -1 )
You have to use ">>" instead of '>>' . Simple quotes (') are used for characters and double quotes (") are used for strings. Here your string will be truncated to a single character.
|
|
|
|
|
Sorry for that inconvenience Mr.Moonen. Hereafter, i will try to give detailed picture while posting.
When i tried with ">>" , it was throwing an error message.
error C2664: 'ReverseFind' : cannot convert parameter 1 from 'char [3]' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast.
can u please tell me where am i coding wrong?
Thanks,
Rakesh.
|
|
|
|
|
ReverseFind only works with single characters. it does not search for strings.
ReverseFind[^]
|
|
|
|
|
ya correct. what else can we do to avoid this warning then sir?
|
|
|
|
|
Search for a single character or use CString::Find[^] multiple times until the string can't be found anymore (and use the last returned index).
|
|
|
|
|
int p = str.ReverseFind('>');
if (p > 0)
if (str.GetAt(p-1)=='>')
then you found a match
|
|
|
|
|
IDE : vc 6.0
I want reduce my project build time, project is quite big one.
Is there any way?
|
|
|
|
|
You can use precompiled headers (however this option is enabled by default). After that, move all the includes to files that doesn't change frequently (e.g. windows.h , math.h and so on) into the header file used to build the precompiled header (usually stdafx.h ).
|
|
|
|
|
ganesh.dp wrote: project is quite big one.
What is big ?
Check for superfluous #include directives, check for badly coupled files (again, #include) dependencies.
If all looks ok, then check to see if you need to rebuild everything everytime. (are there some libraries/dll than can be build once in while ? instead of everytime ?)
If all else fails, have a look at distributed build system (xoreax[^] comes to mind, and it still support VC6).
M.
Watched code never compiles.
|
|
|
|
|
If the code resides on network drive, its take a huge time
|
|
|
|
|
There's loads of ways to speed up build time by writing your source code to build fast:
- The main one is reduce dependencies between compilation units. Don't include things that you can get away with forward declaring and don't do daft things like have single include files with global lists of error codes
- Use interfaces and parameterise from above (PFA) to decouple class implementations from each other
- Use PIMPLs to hide implementation details of classes. Don't use protected or private member functions in your base classes
- Use DLLs and libraries to help you reduce dependencies and DLLs to reduce link time
- (Controversial) Don't use precompiled headers, or if you must only include stuff that's not going to change (standard library headers, third party library headers e.g. boost headers, windows headers). Hiding OS interfaces under portable ones will help speed up your builds as using portable interfaces don't require dragging in loads of OS headers
Generally if you're talking less than a second on average to compile each source file and less than 10 seconds for a link there's probably not a lot of reason to try and speed things up more. Another option would be to invest in a newer compiler - VC++2010 has loads of advantages for building over VC6 even if you don't care about the other things like standards compliance and C++0x features.
Have a look in "Exceptional C++" by Herb Sutter and "Large Scale C++ Design" by John Lakos for more ideas along these lines.
Cheers,
Ash
|
|
|
|
|
Hi all,
I am trying to write to a port using CreateFile() and WriteFile() API's, but my WriteFile() is returning zero and on calling GetLastError() its returning error code 997 ERROR_IO_PENDING. I Know how to read a file when this happens but i am not getting how to write the file. Can anybody help me in doing this...
Here is the code
serial_handle = CreateFile(port_arg, GENERIC_READ | GENERIC_WRITE,
0, NULL, OPEN_EXISTING,FILE_FLAG_OVERLAPPED,NULL);
success = WriteFile(serial_handle ,&temp,5,&temp1,&overlappRead);
I am not getting how to move ahead in this case
Thanks in advance
|
|
|
|
|
WriteFile
OVERLAPPED Structure
See: If the function fails, or is completing asynchronously, the return value is zero (FALSE)
NoteThe GetLastError code ERROR_IO_PENDING is not a failure; it designates the write operation is pending completion asynchronously.
So your Write operation may be pending, so try checking 'Internal' member of OVERLAPPED structure or do Wait on its 'hEvent' member.
|
|
|
|
|
If serial_handle was opened with FILE_FLAG_OVERLAPPED and lpOverlapped is not NULL, the write operation starts at the offset specified in the OVERLAPPED structure and WriteFile may return before the write operation has been completed. In this case, WriteFile returns FALSE and the GetLastError function returns ERROR_IO_PENDING. This allows the calling process to continue processing while the write operation is being completed. The event specified in the OVERLAPPED structure is set to the signaled state upon completion of the write operation.
If serial_handle was not opened with FILE_FLAG_OVERLAPPED and lpOverlapped is NULL, the write operation starts at the current file position and WriteFile does not return until the operation has been completed.
The former is asynchoronous and the latter is synchoronous.
about your question,you can invoke "GetOverlappedResult(
HANDLE hFile, // handle to file, pipe, or device
LPOVERLAPPED lpOverlapped, // overlapped structure
LPDWORD lpNumberOfBytesTransferred, // bytes transferred
BOOL bWait // wait option
);" this function to get result of WriteFile();
eg:
success = WriteFil(serial_handle ,&temp,5,&temp1,&overlappRead);
if(!success)
{
DWORD dwErrorCode = GetLastError();
switch(dwErrorCode)
{
case ERROR_IO_PENDING://IO is operating
{
GetOverlappedResult(serial_handle,&overlapped,&temp1,TRUE);
//infinitely wait for WriteFile() operation compelete
break;
}
//others error code
default:
{
break
}
}
}
|
|
|
|
|
Hi all ... I'm a 3rd year computer engineering student ... And i do have an idea but so far we learn how to make client-server using " sockets " but the message queues is new method for me ... I'm required to do this project about how to develop authentication server that serves multiple clients at a time
the client gives the name and password as request and the server authenticates the request and returns the result ... ALL communications between client and server should use message queues techniques ...and i want it in c language ... Can u help me with the code ... appreciate it soo much ..
|
|
|
|
|
do not cross post. You already have asked this on the ATL forum
|
|
|
|
|
Hi Ralph, you have already posted a question about this problem in the Q&A section. Please, don't post the same question to multiple forums.
To get a good answer the best is to choose the forum that better match your requirements and post your question only there.
|
|
|
|
|
ok .. sorry guys I'm new user here .. i'm trying to get used to it ana learn ... any help with my question ??11
|
|
|
|
|
ralph 2 wrote: I'm new user here
Well you should have read this[^] first.
It's time for a new signature.
|
|
|
|
|
I did .. thanx ... I noticed that you r guys just Criticize not actually giving help .. if i knew that would be your attitude i wouldn't ask for help at all .. thanx anyway
|
|
|
|
|
ralph 2 wrote: I noticed that you r guys just Criticize not actually giving help
Maybe because you didn't ask any clear question. Where are you stuck exactly ? What did you already try ? What is the problem ?
Nobody is going to write your application for you.
|
|
|
|
|
I know how to use the system calls an prepare the msg queues then send or receive it but the problem with me is how to Authenticate a user in a previously stored database let say " txt file " ... I tried to make two threads the 1st writ a message and the second receive it ..
|
|
|
|
|
ralph 2 wrote: I did .. thanx
Did you actually understand points 1, 2 and 11?
ralph 2 wrote: I noticed that you r guys just Criticize not actually giving help
This is not true at all. If you take the time to read these forums you will see that the great majority of answers are examples of help being offered. However, we expect people to do their own work not just post a general question asking someone else to do it for them. We are especially not going to write school/college/university projects so other people can get fraudulent qualifications.
It's time for a new signature.
|
|
|
|
|
Richard : I didn't mean the forum or the other guys really i amazed by how much they r helpful .. I'm talking about the replies I received from u guys .. I'm doing my best believe me .. but this material we didn't cover in the class So i have no idea how to start .. i did my own research and without benefit .. you don't even know how hard was this semester for me especially in the " SP " course ... I'm not trying to get fraudulent qualifications I'm just trying to solve my project which has almost 1/3 from the overall mark ... sorry for bothering and than for the help
|
|
|
|
|
ralph 2 wrote: I'm talking about the replies I received from u guys
All the replies are trying to educate you as to how you should use the forum: don't cross post, don't demand code, etc.
This is what you wrote in your original question:
ralph 2 wrote: ALL communications between client and server should use message queues techniques ...and i want it in c language ... Can u help me with the code
which suggests that you are expecting someone to write the code you need and post it here, which is not what we do. You are expected to do your own research (I posted you a link with some samples of message queue processing) and try and write your own program. Then when you get to a stage where your code does not produce the results you expect you can ask for help, as long as you demonstrate that you have at least tried to do your own work. You may be surprised at how much help people will give to such questions.
It's time for a new signature.
|
|
|
|