12,511,383 members (88,663 online)
Forgot your password?
Sign in using
Chapters and Sections
Article Help Forum
Submit an article or tip
Post your Blog
Ask a Question
View Unanswered Questions
View All Questions...
All Message Boards...
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Design and Architecture
C / C++ / MFC
ATL / WTL / STL
Objective-C and Swift
Hardware & Devices
Hosting and Servers
Silverlight / WPF
Site Bugs / Suggestions
Spam and Abuse Watch
The Insider Newsletter
The Daily Build Newsletter
Most Valuable Professionals
The Insider News
The Weird & The Wonderful
General Indian Topics
General Chinese Topics
What is 'CodeProject'?
Ask a Question
Bugs and Suggestions
Article Help Forum
Advertise with us
About our Advertising
edric Moonen (Top 31 by date)
Yes, so ? What is the problem with the solutions I provided you ? Did you even read my answer ?
Your buffer is NULL, so how can you add bytes to a non-existent buffer ? You will first need to allocate a buffer for 40 bytes (using new in C++ or malloc in C). Of course, you won't be able to add bytes to that buffer after that except if you use one of the solutions I provided.
Could you also post the exact error message displayed when your code crashes ?
In fact this "trick" comes handy in some specific situations: for a specific factory design pattern. If you make the factory a singleton, then each element that has to be created by the factory can register itself (before the main starts) using this technique. This allows to decouple the factory from the elements it has to create.
Look at the solution I provided (solution 7), this is doing something similar as your java code...
Is your xml format always the same or should your application dynamically adapt to different xsd files ?
In case you have one format, did you consider generating code based on the xsd ? If you are developping an open source software, you can have a look at codesynthesis (http://www.codesynthesis.com/products/xsd/). They also have commercial licences.
On the other hand, you can also consider a lightweight XML parser like TinyXML (http://www.grinninglizard.com/tinyxml/) but in that case there's no databinding involved.
Yes, but as you didn't reply mine, I can't really give an appropriate one. Can you please describe precisely the situation that you have ? Why is the XSD important in your case? Because it looks like it's not used...
You can't distribute the dll's anymor, you have to install the C++ redistributable package on the target machine.
Please read the documentation of GetLine, it is stated explicitely that: "If the function stops reading because this size is reached, the failbit internal flag is set". They are talking about the second parameter of the GetLine function (you pass 2). This is also the reason why it looping infinitely: the fail bit is set so no data is read anymore but the end of file is not reached. Check the function documentation here: http://www.cplusplus.com/reference/iostream/istream/getline/
I'm afraid this is not possible, I can't just give an example like that in OpenGL. OpenGL is a quite complex library (but also very powerful) and it will require some time to learn how to use it properly. If you really want to do that, I suggest you buy a book about OpenGL (this one for instance: http://www.opengl.org/documentation/red_book/) and start learning from that. There are also some nice tutorials on this website: http://nehe.gamedev.net/ (but it is a bit more targeted to games).
I'm not aware of other cross-platform graphical libraries which are easier to use. Maybe you should google for it and see if you find something interesting.
mmc ? What's that ? Please be specific in your question because it doesn't make a lot of sense right now.
Only if it is a Win32 application. We still don't know which kind of app he is developping.
Yeah but you can write a Win32 application with Code:Blocks. So, is it a win32 app or a console app ?
This is still not clear. Why do you want to hand out the sources of your dll ? There's no need for that. As I said in my previous reply, just distribute the library file and the header files. You don't need to distribute the cpp files.
Did you have a look at the link I provided ?
What you could do is have an update(int timeElapsed) method of the class. The timeElapsed argument represent the amount of msec elapsed since the last class to update. Inside the class, you can specify its speed and easily calculate the new position of the sprite (based on the previous position and time elapsed). The update method is constantly called from your main loop (you have control over your main loop so you can adjust the update rate).
That's something different. What you asked for is be able to send data with a delay, not at a different rate. You can't send data faster than you receive it (and sending data slower than you receive it is not possible neither, since you will need to accumulate the data and at a certain point, your system will break). The popping thread isn't faster, it just pops data with a certain delay.
Well, you have your thread which is already receiving the data that will push the data in the queue, and you have one additional thread that is responsible for extracting data from the queue. What you could do is when you put data in the queue, you also keep the time at which it should be sent. Your thread that pops data from the queue will be notified via an event when data is pushed into the queue. At that time, it looks at the first data in the queue and wait for a certain period of time (until it reaches the specified time).
It is a bit complicated to explain but basically you have one event which is shared by the two threads: when data is pushed into the queue, the first thread signal the event to wake up the second thread, signaling it that data is available. This second thread, when woken up, will take the first data and look at the time at which it has to wake up. If the wait times out (meaning that no data has been pushed into the queue and that we reached the time at which we need to send data), the second thread takes the first data, sends it and looks if there's more data availble. If not, it wait for an "infinite" time on the event, otherwise it waits until the next data should be sent.
Very vague question. Please clarify what you want to achieve exactly, what you already tried and where you are stuck precisely. Nobody's going to provide the full code.
What does it have to do with C++ ? Are you aware that this is a programming forum ?
I don't have much experience with that but if that's what you want to do, then it is much elegant solution than using MSPaint (basically, you want to redo what paint is doing internally). You can have a look at the CImage class for instance: http://msdn.microsoft.com/en-us/library/bwea7by5(VS.80).aspx.
Or even CxImage: http://www.codeproject.com/KB/graphics/cximage.aspx.
You will need to do some research but it is definitively a much better option than using paint.
If you want an example, you can have a look at the code of my charting control (http://www.codeproject.com/KB/miscctrl/High-speedCharting.aspx). In the ChartCtrl.cpp file there is a SaveAsImage function, which does exactly what you want. It is rather easy to create a CImage, draw to it and save to a file (much easier than your solution).
You still didn't answer my questions. I know that you are migrating Java to C++. But migrating doesn't mean blindy "translate" from java to C++. You have to understand what the program does and in this case what the program is doing with the objects in the map. So please, read my post once again carefully and try to answer my questions. The more precise you'll answer, the more chance you'll have to receive a precise answer.
Your code snippet is unreadable. Anyway, your design is probably very bad if you have to store any kind of object in the same container. What is its purpose ? What will you do with the contained objects ? What do you mean also by "system defined" ?
The important point here is that the objects in the container have to be used in some way. And you can't use an object if you don't know what it is (of course you can later check its type but still, I don't see clearly what you're going to do with that).
Reason for my vote of 1
You could try asking Santa
Did you realize that the question was posted in september 2008 ? Chances are that the OP is not interested in the answer anymore...
I don't know the mp3 format, but isn't there any header ? I would guess a header is needed at least to define the bit rate. So, you can't simply concatenate the files this way.
You certainly won't put your edit control as a global variable. Instead, when the user pressed the Ok button, you get the text from the edit control and store it in the global variable (which is a string).
I don't agree: calling lock on a CCriticalSection which has already been locked by the SAME thread is not a blocking call. This is safe and in certain conditions perfectly acceptable. See the link that Iain provided (well, it is for CRITICAL_SECTION and not for CCriticalSection but the principle is the same).
Reason for my vote of 1
No, nobody is going to go through all the code without even knowing what is wrong with your progam. Ask a SPECIFIC question.
Nah, such a program should at least contain the mandatory "Hello World" words :-)
Then it might be that your exe and your dll do not use the same heap. Make sure that they are both using the same version of the C runtime library (check that both the DLL and your exe have the same value for the "Runtime library" option in the project settings.
Web02 | 2.8.160929.1 | Last Updated 1 Jan 1900
All Rights Reserved.
Terms of Service