Click here to Skip to main content
14,600,948 members

Comments by Rick York (Top 200 by date)

Rick York yesterday View
You are the one asking people to write code for them.
Rick York 29-Jul-20 11:19am View
Your instructor needs to re-think the prerequisites of that course. A course that uses a book on Operating Systems should require the students to be fairly experienced in the C language. Memory allocation is a difficult problem and not for beginners in the C language.
Rick York 26-Jul-20 18:30pm View
My preferred work around to this issue is to avoid the problem entirely. I can't remember the last time I wrote a console program that required input from the user. I messed around with a very old console program today but even it does not prompt the user for input. If I require user input then I write a GUI or read it from a file.

Regardless, you are entirely correct.
Rick York 26-Jul-20 18:22pm View
Good point. Let's hope he sees that.
Rick York 20-Jul-20 16:34pm View
you should avoid writing expressions like that because they can be prone to error. It is better to first dereference the pointer (*p) and use that value. Then increment the pointer when you are done with its value.
Rick York 20-Jul-20 16:30pm View
OK, I considered. What is your question? If it is, "why doesn't my code work?" exactly how are we supposed to guess that?
Rick York 17-Jul-20 11:27am View
It appears to me that you found a number guessing program and now you want someone to change it for you so it works for this assignment.

Do your own work. You won't learn anything unless you do.
Rick York 16-Jul-20 12:33pm View
I am very glad to read that you got it to work. I am not at all an expert on this stuff. I just remembered something about this particular function. Best of luck with it.
Rick York 13-Jul-20 19:48pm View
I recommend that you look at the isalpha and isdigit functions. They can take care of much of your conditional logic. There are a few other related functions that can help too.

You realize there are other forms of punctuation also like commas and colons, right?

Lastly, I highly recommend that you learn how to read data from files. This will save you a lot of time typing input so you can spend it writing code and debugging it. I can not emphasize this enough. You will be glad you did.
Rick York 13-Jul-20 15:49pm View
The word is PLEASE.
Rick York 13-Jul-20 2:06am View
Define "an octal integer" and "a binary." This is important because you have not identified the terms of the conversion. If this is two pieces of binary data then there is no conversion necessary. If one is a string and the other isn't that is different than if both are strings. It is very, VERY important to be precise in one's definitions and terminology because misinterpretations can lead to big mistakes.
Rick York 12-Jul-20 14:06pm View
One recommendation : learn how to read data from a file so you don't have to enter your data by hand every single time. This will give you much more time to debug your code and make it run correctly.
Rick York 10-Jul-20 11:11am View
My guess is you have a version mismatch problem with MFC DLLs. Try rebuilding the DLLs. If you can't do that then you probably need to stay with VS2010.
Rick York 10-Jul-20 3:04am View
I recommend two things : learn how to generate random numbers so you can have random arrays because you will get tired of entering values very quickly. If you don't want random arrays then read them in from a file. Either way, you will be glad you did. The other thing is write two output functions for yourself. One to output 1D arrays and one for 2D. You don't need any more than those two and you certainly don't want to duplicate that code all over the place either.
Rick York 9-Jul-20 21:41pm View
I would like to help you but I can't find that file or the control in any files in my installation of VS2019
Rick York 6-Jul-20 11:27am View
I hardly think this is worth a 1. Must be some SFB who can't handle C++.
Rick York 6-Jul-20 11:24am View
1. I don't know - look up the docs on the mplabxide.
2. Yes.
3. I don't know - look up the docs on the tbs 1052B.

There is nothing here a search at google or elsewhere will not tell you.
Rick York 5-Jul-20 17:12pm View
What kind of graphics? 2D, 3D?
Rick York 1-Jul-20 22:36pm View
What is the list view supposed to be? Is it a pop-up window? Part of dialog? A new component in the main window?
Rick York 30-Jun-20 23:52pm View
Currently, the code as posted does not call the function you have written.
Rick York 30-Jun-20 15:11pm View
OK, what is your question about this?
Rick York 30-Jun-20 12:35pm View
I think Grif did, I did not.
Rick York 29-Jun-20 21:15pm View
Note : math.h defines the constants with a leading M_ prefix. Pi is M_PI.
Rick York 29-Jun-20 21:13pm View
My answer was to avoid using the CCheckListBox class entirely. I use a list control derivative and place a check box in the first column. This draws correctly so it's all good.
Rick York 26-Jun-20 21:33pm View
You should avoid using the literal value 26. It might seem like a trivial thing but what would happen if you switch to a different language with more or less than 26 characters in its alphabet? There are several alternatives you could use. One simple one is to define a constant value. Optionally it could be set to the length of the string. However you want to do it is better than not doing it.
Rick York 19-Jun-20 15:57pm View
call CharFromPos first.
Rick York 19-Jun-20 15:57pm View
call CharFromPos first.
Rick York 18-Jun-20 21:29pm View
If it does not build then it can not possibly crash. You have to build it before it can run.

As a wild guess, make sure a, b, and p have a size bigger than the value n. If they are vectors are they initialized? If not then use push_back to save the values.
Rick York 18-Jun-20 21:22pm View
If it does not build then it can not possibly crash. You have to build it first before it can run.
Rick York 17-Jun-20 13:33pm View
pragma once has nothing to do with his problem. He is trying to solve the multiple definition problem.
Rick York 17-Jun-20 13:30pm View
Deja vu, all over again.
Rick York 14-Jun-20 19:39pm View
Which OS will this be written for? It's important because the threading APIs vary between OSs.
Rick York 14-Jun-20 12:35pm View
I work with a lot of STL and internal library stuff and I decided to choose one string class and stick with it. It's not really that I don't like it. It's just that I try to avoid all MFC collection and template classes and use STL things instead.
Rick York 13-Jun-20 18:40pm View
clear() is member of std::basic_string - I forgot you were using CString and I never use it. I believe it has an Empty() method that will do the same thing but it should be created empty so it is not necessary there.

BTW - this should be posted as a comment to my post and not another solution, just as I am replying to your's.
Rick York 12-Jun-20 17:16pm View
No, sprintf, strcpy, and strcat will not be banned, nor will MBCS. They are standard library functions and Microsoft does not have the authority to ban them from the library.

If they do remove them from VS's RTL then you can use your own implementations of them. I am certain there will plenty to choose from.
Rick York 11-Jun-20 16:25pm View
I have rule. If a poster can not be bothered to write out the word "please" I can not be bothered to spend any of my time helping them.
Rick York 10-Jun-20 15:46pm View
OK, what is your question? "Will you do this for me?" is not a valid question and the answer is NO!
Rick York 10-Jun-20 2:56am View
Rick York 10-Jun-20 2:55am View
Rick York 9-Jun-20 22:05pm View
The same way you convert ANY code to pseudo code.

The fact you are asking about this code implies you want someone to do this for you. Maybe someone is bored enough to you show mercy. I will not.

This might help :
Rick York 9-Jun-20 21:56pm View
It appears your code was clipped off. I added pre tags and indentation of four spaces per tab level.

You need to ask a question. It is not reasonable to expect people to wade through a bunch of code and figure out what, if anything is wrong.

I recommend you change the House class a bit. Add a default, empty constructor that takes zero arguments and add a Prompt method that prompts the user for the data. You have repeated this section of code twice so it is a good candidate for a method or function.

Also, std::string has an == operator so you can directly compare equality with it.

You might to want make the house type member an enumeration instead of a string and accept case insensitive input.

If your program is not working correctly this would be a good opportunity to learn how to use a debugger. They are an essential tool for effective programming.
Rick York 8-Jun-20 17:53pm View
This is managed C++ and it is an important distinction to make.
Rick York 8-Jun-20 13:46pm View
For help with the algorithm you might want to check out the Wykobi library at There was an article here on it but I can't find it any more. It has a lot of computational algorithms specifically for this kind of thing and there is a demo program that illustrates most of them.
Rick York 5-Jun-20 13:06pm View
Then you better learn faster. If you are so desperate for help you might consider being sincere about it. Writing in text-speak is not being sincere. It is being lazy and I refuse to help anyone who can't be bothered to spell the entire damned word. People who are so sincere they can only manage to write thx really set me off.
Rick York 5-Jun-20 13:04pm View
You do know there is a difference between helping you and doing your work for you - right?
Rick York 5-Jun-20 10:51am View
You might want to consider the FooButton class at this site by Ravi Bhavnani. It is an owner-drawn button class for use with MFC. I use it extensively and it is pretty good.
Rick York 2-Jun-20 11:49am View
You would be better off having a function to call and pass it a year and it returns a boolean value of leap year or not.
Rick York 2-Jun-20 0:09am View
I guess I was too late. Oh well.
Rick York 2-Jun-20 0:04am View
What is the significance of the numbers 30, 12, and 4 ? You are using this code in the constructor?
for (int i = 0; i < 30; i++)
    name[i] = new char[12 * sizeof(char)];
and it makes no sense. The variable is declared as :
char* name[30];
That is thirty pointers to characters. I seriously doubt that is what you want. You appear to be asking for one string that is the name. Why allocate 12 characters? It would make more sense to declare the name as just a character array like this :
char name[ NameSize + 1 ];

I asked about those three numbers because that is very bad form. Those should be constants. If you use this declaration you need only one constant and you can get rid of the construction and deletion. Since this is C++, it would be best to use a std::string to hold the name. Then no allocations of any kind are needed. Actually, you don't do anything with the name so you really don't need it at all.

Lastly, calling system should be done only on the rare occasions when no viable alternative is available. This does not qualify. It would be much better to call getchar() or a similar function to get a keyboard entry.
Rick York 31-May-20 11:50am View
I use it (strtok) all the time. One must remember it is a destructive parsing function because it will nullify all delimiters it finds. One can achieve similar results, non-destructively, using strcspn in a loop. I suspect strtok was written using strcspn.
Rick York 27-May-20 15:41pm View
The data you are sending is not exactly readable in text console. It is just a bunch of characters. Try sending something that is an actual text string like "abcdefg". If that is not exactly what you want then display the values received in hexadecimal format since that is how you load them.

One thing needs to be made clear : you are not sending a hexadecimal array. You are sending a set of five characters. The characters can range in value from 0 to 255. You are loading the characters into the array in hexadecimal format but that is irrelevant. You could have loaded the characters 0x31, 0x32, and 0x33 if you wanted to. Those happen to be equivalent to '1', '2', and '3' in ASCII format.
Rick York 26-May-20 18:49pm View
That is C++ - you have a lot more than just logic errors if you want to use it C.
Rick York 26-May-20 18:47pm View
Of course there is. It's your homework though so it would be best if you fix it.
Rick York 25-May-20 17:48pm View
There is NO direct conversion of MIDI to WAV files. MIDI files must be "rendered" or processed to generate sound using a synthesizer. That is step 1. Then the rendered sound can saved as a WAV file and that is step 2.
Rick York 25-May-20 14:30pm View
Look for a class at this site called CLabel. It is an owner-drawn replacement control for CStatic. With it, you can set the foreground color, background color, and text font to use for the control. It is very handy and I use it often.

I did the search for you :
Rick York 23-May-20 18:14pm View
Yes, I didn't look that far. The first errors were so obvious I didn't bother.
Rick York 19-May-20 15:33pm View
I wrote my own grep many, many years ago and I didn't bother with the fancy expression evaluation. I just accepted an argument for case sensitive match or not which is quite useful. I then added a simple wildcard matcher to accept varying file name patterns. That was really helpful too.

I recommend starting with a bit simpler implementation, something along the line of what I described.
Rick York 19-May-20 15:23pm View
Interesting problem. I might give it a try for my own amusement.
Rick York 17-May-20 23:42pm View
Doesn't ALP stand for Assembly Language Program?
Rick York 17-May-20 23:40pm View
You better figure it out then.
Rick York 17-May-20 12:15pm View
Yes : your program does not work right.
Rick York 15-May-20 3:57am View
That is exactly what I was warning about. That will give a random sequence every time and might not be what they want. Seeding with the same value will give a consistent sequence every time and that might be preferred for evaluating adjustments to algorithms and parameters.
Rick York 15-May-20 2:30am View
That sounds much better to me. Best of luck with it.
Rick York 14-May-20 14:55pm View
or is it RAND_MAX? I can't remember. I need to RTFM.
Rick York 14-May-20 3:17am View
I can't think of a good reason for deriving from both a map and a vector. I can think of several good reason why not to.
Rick York 12-May-20 15:07pm View
You already have the code for all of the functions now. You just have to make the declarations for them and add the code. You can see how they are called in the solution and you know the types of all the arguments - you just pass them exactly as they are declared. For example, WriteMatrix takes a pointer to a file object and the matrix. The pointer to the file is a FILE * and the matrix is an int ** so that is what you pass to it. It has no return of interest so its prototype will look like this : void WriteMatrix( int **matrix, FILE * fp );

That's really all there is to it.
Go through this process for the other functions and you will have it. Make sure the names of the variables in the functions matches the names you give the arguments.
Rick York 10-May-20 13:35pm View
I think a better question is what difference does it make? followed closely by who cares?
Rick York 9-May-20 12:45pm View
You might have better results if you show a bit of respect. Do you think adults have any interest in helping someone how will not spell out the phrase, "can you please"?

The answer is certainly. I can and lots of people at this site can. However, I choose not to. The last thing the world needs is more programmers incapable of solving simple problems.
Rick York 8-May-20 22:15pm View
I don't have a specific answer but I think the first thing you should do is make sure your showData functions correctly and call it OFTEN! After every single operation you should display your list and make sure it is still valid. This is known as printf style debugging. A better option is to learn how to use your debugger.

Actually I think your whole approach is wrong. I think you should read all your data into memory and save it in a container of some sort. std::list and vector are good options. List is better for insertions and removals so that is the better option. Then manipulate your data in memory. When you are done with the data then write it all out to a file at one go. Doing things intermittently to the file like you are is asking for trouble in my opinion. As far as I am concerned that is really only a good option if the file is to big to fit into memory conveniently.
Rick York 8-May-20 11:03am View
That's not all I wrote. I also wrote about checking for errors in the move function. Make sure neither goes below zero or above the size of the maze. That was the other purpose for putting things in one place.
Rick York 8-May-20 2:44am View
No, it is most definitely not complicated. The source x and y are always going to be i and j. The destination depends on which way it is moving. The example I showed was to j+1 in columns. This means the arguments to the function will be (i, j, i, j+1) to move right. Now you need to associate those four arguments with the logic in the example and you will have your function. The key here is those four parameters can be destx, desty, srcx, and srcy so then look how j+1 was used in the example snipped and substitute it with argument srcy that you will pass to it. Then do that with the other three arguments. The first i, paired with (j) will be destx and that lone j will be dest y. The second i which is paired with j+1 becomes srcx.

I am NOT going to write this for you because YOU need to do it.
Rick York 24-Apr-20 13:19pm View
It is important to note this is managed C++ and not standard C++. I suspect that is a large part of your problem. I know very little about that so I can't help you.
Rick York 21-Apr-20 14:01pm View
"Since C++ doesn't have boolean values"

It has a bool type that can be only one of the built-in values of true or false.

How is that not a boolean value?
Rick York 19-Apr-20 3:31am View
How can anyone help you when you have not defined your constraints? If this ini file is in use by the machine I will be surprised if it has an internet server running on it that will provide access to the file. Unless that is true you have to use one of the file access APIs but we don't know because you won't answer the question.
Rick York 17-Apr-20 23:26pm View
No, I do NOT have to choose. This is most definitely not my problem.

There are plenty of samples to help you with any API family you chose.

Rick York 17-Apr-20 18:47pm View
I have dealt with ones that can append a new line or tab after their barcode. I found we used the tab option almost constantly since that is the standard key to navigate between fields. In the end we made no alterations to any software to deal with the barcode scanner. It was one that plugged inline with the keyboard and it just worked.
Rick York 17-Apr-20 2:01am View
Does any compiler really support long double any more? I know Visual Studio does not. It aliases them to a plain double and sizeof returns 8.
Rick York 14-Apr-20 4:17am View
No, a forward declaration is not required. The code will compile without it.

-edit- that is, VS2017 will compile it.
Rick York 13-Apr-20 16:27pm View
Have you identified which part is not working?

You are calling five different USART functions from this IRQ handler so start from the beginning : is the handler getting called? Then verify each function call from there. Debuggers are useful for this kind of thing but I know they can be difficult in embedded environments so some kind of trace mechanism can help with this if printf-style debugging is an option.
Rick York 13-Apr-20 3:50am View
The dot product involves two vectors. I have never heard of a dot product of matrices. One can multiply two matrices but that is not the same thing.

There are tons of matrix classes available. Even some here. A bit of searching should turn some up for you.
Rick York 11-Apr-20 19:16pm View
No, not at all. ProfCollection owns the collection and manipulates it. There are more methods needed for accessing the members of Professor that were not included in the solution.
Rick York 10-Apr-20 11:33am View
Your organization seems backwards to me. In my opinion, the name, role, and subject should be strings and the class should represent ONE professor. Then you should have a collection of those which could be a vector or list. Those collection have a size() method so you do not need a count member. Your main function would contain the instance of the collection. You could also make a class to contain the collection and the methods to display, remove, and add entries to the collection or those could be plain function that operate on the collection of professors.
Rick York 10-Apr-20 10:34am View
How does this qualify as a solution?
Rick York 8-Apr-20 22:06pm View
He just did. Read the wikipedia thing, refer to his example, and give it a go.

It is up to YOU to interpret the code and you were just shown how.
Rick York 7-Apr-20 23:40pm View
I don't have a solution for you but this is obviously a great opportunity for you to learn how to use the debugger. It will show you what is going on with your program so you can find your error.
Rick York 5-Apr-20 13:45pm View
It is an example of rather bad code because it has global variables that are one and two characters long. That is very, VERY bad practice. I see no need for any of those variables to be at global scope in the first place.
Rick York 2-Apr-20 14:32pm View
Where a stack is concerned, "right to left" doesn't mean anything. A stack has two operations : push and pop, and they both operate on the top of the stack. If you want it to work differently then that it is no longer a stack and becomes something else. If you really want a stack mechanism and need a "right to left" order then look at how the data is loaded into the stack. If you actually want a different storage mechanism then don't use a stack. Use something else like a queue.

BTW - you might want to consider adding some error checking to your code. Things like don't allow popping from an empty stack and, since your stack appears to have a fixed size, don't allow pushing onto a full stack.
Rick York 24-Mar-20 15:52pm View
I think it is time to just stop answering the same question. It has been answered enough times that if he still can't get it then he should seriously consider another line of work.
Rick York 24-Mar-20 2:54am View
Hopefully he is able to figure out how to peel off one character at a time into a temporary string and convert that.
Rick York 22-Mar-20 23:15pm View
This is how length is spelled.

I don't know assembler language because I have never found it necessary. I once wrote an on-the-fly machine code generator though. I did it by figuring out what machine code was emitted by writing code snippets in C and then examining the compiler's assembler and machine code listings. I recommend doing that for this code. It is quite simple so write it in C and then look at what the compiler does with the code in its assembler listings. That's how I would proceed anyway.
Rick York 22-Mar-20 12:51pm View
OK. So what is your question?
Rick York 20-Mar-20 2:00am View
I don't have a solution for you so this is a comment. If you want people to help you that often involves replicating the code and trying it out. In your case, you should remove all of the file copying stuff. Just print a message to a debugger or something to state what happened because that's what your problem is. That code shouldn't be there anyway. You should be calling a function somewhere to do what you want and pass it the parameters of interest.
Rick York 19-Mar-20 10:56am View
I will repeat myself : "I think it would be best if you modify your question to ask about what your intentions really are." Remember to use the code tags around your code and indent it properly so people can read it easier.
Rick York 19-Mar-20 10:52am View
If you can't even manage to write out the word please then no, we can't help you.
Rick York 16-Mar-20 11:29am View
I used VS2003 for a long, long time. Then I jumped to VS2008 and then VS2017 and I found the code really did not have to change very much at all. Only a few things specific to MFC had to. Otherwise the moves were quite painless. You can now utilize some new language features from C++11 and C++17 if you do migrate. VS2017 and VS2019 can be obtained for free so I wouldn't hesitate to do so.
Rick York 15-Mar-20 15:12pm View
I also called the function in a loop so I didn't have to enter the number of terms. I set the loop count to 10 to get the output shown.
Rick York 15-Mar-20 3:21am View
When I wrote item 9 I meant arr[9].
Rick York 15-Mar-20 3:14am View
Not cool??? What I wrote was written BEFORE your edit.
Rick York 13-Mar-20 2:02am View
The question did not ask to have the first item printed.
Rick York 12-Mar-20 16:19pm View
How does the first item qualify as a member of the set of every tenth element?
Rick York 12-Mar-20 16:04pm View
This solution is incorrect. When i is 0 it prints item 0 and that IS NOT the tenth element. It is the zeroth element, if that is even a word.
Rick York 12-Mar-20 16:03pm View
This solution is incorrect. When i is 0 it prints item 0 and that IS NOT the tenth element.
Rick York 10-Mar-20 20:43pm View
C++ has a number of collection classes including deque and vector which can be used to construct a matrix (a vector of vectors). You should be able to convert your code fairly easily. The len function appears to be the same as size in the vector class. For a useful reference have a look at
Rick York 8-Mar-20 12:52pm View
Rick York 6-Mar-20 11:02am View
Incidentally, I have been working with CUDA lately and this is how code is parallelized in it. I can imagine this program parallelized to work with GPUs and it would be really fast on large numbers.
Rick York 5-Mar-20 11:28am View
That is why I wrote, "provide a prototype..." If it is undefined that means you have not provided a prototype for it so it will be defined.
Rick York 26-Feb-20 12:07pm View
When diagnosing a problem it is helpful to know what is going wrong. The statement "it isn't working" is not helpful. For me to respond, "make it work" is about equally helpful.
Rick York 19-Feb-20 10:44am View
Thank you. I tend to agree. ;)
Rick York 12-Feb-20 23:24pm View
Have you tried searching?
Rick York 8-Feb-20 0:43am View
If you set up the code correctly, each call will split it into fourths. So, yes, call it three times.
Rick York 6-Feb-20 11:19am View
steveb's comment above had the hint for you. To use WaitForSingleObject you must pass it an object to wait for. That can be any 'handle' object that can be signalled. In your case, you need to declare an event object (CEvent or similar) accessible to the class that receives the keyboard messages and set the event when a key is pressed.
Rick York 4-Feb-20 11:02am View
I can certainly understand the cussing. I ran this little function in my testing program and it worked as expected, with no exceptions. It essentially what you have with a few zero assignments removed since you took care of that already.

void DoOpenFileNameTest()
TCHAR filePtrC[ MAX_PATH ] = { 0 };
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof( ofn );
ofn.lpstrFile = filePtrC;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrFilter = L"All\0*.*\0Text\0*.TXT\0";
ofn.nFilterIndex = 1;
if( GetOpenFileName( & ofn ) )
trace( _T( "selected '%s'\n" ), filePtrC );
trace( _T( "ope file name was cancelled\n" ) );

The only thing I can think of is something very weird is going on with your system. If you have another system with VS on it available you should try it there and if it works then pay close attention to the DLLs you see loaded in the debugger's output window and try to see how they differ from your system where it fails.
Rick York 28-Jan-20 16:00pm View
In some cases, the extra 8 bits is used for an alpha channel that determines transparency.
Rick York 28-Jan-20 11:10am View
A precise answer depends on the development and working environment of your program. Are you using W32, QT, Wx, CLI, ...? The list goes on.
Rick York 21-Jan-20 10:50am View
Have a look at my revised solution.
Rick York 20-Jan-20 11:16am View
What we really need to see is how v_stockRows was declared. The act of adding data to the vector crashes the program so that means in the push_back function is causing the problem. The key to that is in how the data is stored in the vector so we need to see that to determine what the problem is. My guess is there is a problem with a copy constructor.
Rick York 20-Jan-20 11:11am View
I agree with Stefan and would add to that, what are "extended" and "non-extended" display modes in windows? I have been programming in windows since Windows NT was in beta and I have never seen anything about those display modes.
Rick York 18-Jan-20 1:23am View
On second thought, I see the date is treated as a string so the time can be also. That would entirely eliminate the Time structure. That would be an easy change to make - to the structure, InitLog, and PrintLog.
Rick York 14-Jan-20 10:46am View
It actually can be redirected by using "2>" (in windows). It's probably best not to tell anyone that though.
Rick York 9-Jan-20 10:58am View
"Better an enum than preprocessor macros or global constant."

How is the enumeration better than a global constant? They are effectively the same thing. One difference is you could easily run into variable type issues using an enumerated value instead of a constant with the specific type it is used for. In my opinion, it is better to have those as constants in a namespace so all the types are correct. FWIW, a class with all static members and methods is effectively the same thing as a namespace.

Also - those function macros could and should be inline functions. Macros should be avoided unless no viable alternative exists.

One last thing - for resource locking I really dislike explicit lock and unlock calls. I prefer to use an excursion class which is a form of RAII. The class would perform the lock at construction and do the unlock at destruction. The end result is the resource is locked for the lifetime of the object. Then it becomes a matter of providing the appropriate scoping to define the correct lifetime for the object.
Rick York 8-Jan-20 17:59pm View
You could read the input data from a file instead of entering it every time. That would make your debugging much faster and easier.
Rick York 8-Jan-20 11:09am View
I have no idea what "4 levels recursive embedding class sets inside itself" means. I know what nested or embedded classes are but where does recursive fit into this? It is also unclear why you must have "4 levels."

Are you sure you need __attribute__ statements for all of the constructors and members? I do it for just the class itself since you nearly always want to export the entire class and not just certain methods.

Lastly, you should reconsider using auto_ptr because it is flawed and has been deprecated. Now one should use unique_ptr or shared_ptr. Generally, unique_ptr will suffice but if you have to transfer ownership of a pointer then shared_ptr should be used.
Rick York 8-Jan-20 10:56am View
You description is not clear. Which thing do you not have the source of? It makes a big difference in how you approach debugging this problem.
Rick York 3-Jan-20 1:24am View
I agree with Patrice. There is no need for search or sorting with such a small data set. Brute force comparisons would be the best option I think.
Rick York 23-Dec-19 11:39am View
So you can automatically register and start spamming sites like this one? Um, no. I will not help you.
Rick York 18-Dec-19 10:57am View
Yes, you can check individual boxes if you want. There are also functions to check them all and uncheck them all.
Rick York 17-Dec-19 20:27pm View
In my opinion, it would be easier to use a CheckListBox for this. Then you have just one control to manage instead of twelve.
Rick York 17-Dec-19 11:19am View
I agree with Stefan. One more thing - I think it's OK to have the base class but you don't have to make everything purely virtual (=0). You can provide defaults that are just empty brackets at least "{}". This means you only need to implement what is necessary. I also agree with him about intermediate layers such as for Lights. It can still derive from the base class but it would have real implementations of the on and off methods. You could even make a further specialization for lights that can be dimmed (LightDim), assuming that not all of them can be which is true for some kinds.
Rick York 17-Dec-19 1:28am View
No, DeleteList traverses the list and deletes all objects allocated. pList will point to data that has been freed and it was not nulled so, yes.
Rick York 12-Dec-19 19:07pm View
Yes, it should. Thanks!
Rick York 10-Dec-19 16:06pm View
I recommend investigating plug-in architectures in general to start. The key will be to define a consistent interface to your plug-in objects. I think the best way is to define the app(s) architecture such that everything is a plug-in. I have done this in previous applications and it worked quite well.

There are a few articles here on this topic :

Those will provide a good start. Best of luck.
Rick York 24-Nov-19 14:45pm View
Question for you: how can we be expected to find an error if we don't know what the error is?
Rick York 24-Nov-19 14:42pm View
What does this have to do with C++?
Rick York 15-Nov-19 15:32pm View
That is most definitely not C++.
Rick York 11-Nov-19 11:03am View
The tricky part was establishing the null session if it didn't work the first time. This is obviously not needed when the server is on the same machine.
Rick York 9-Nov-19 16:02pm View
Try this :
Rick York 9-Nov-19 12:21pm View
You still don't get it. WTF does "do countdown timer from 24 to 0 mean?"

Do you want be able to ask an object how much time has elapsed?
Do you want a message sent to a window after 24 hours?

Rick York 9-Nov-19 12:12pm View
All of your questions are very vague and result in us guessing what it is you are really asking. You need to be much more thorough and descriptive when you ask your questions.

For this one, what is it you want the timer to do? Signal an event after X milliseconds? Decrement a counter down to zero? Exactly WHAT? There are many, many possibilities and its a waste of everyone's time to guess what it is you are after.

Note that the phrase, "countdown timer" really does not mean very much. Also, if all you want to know is when X time has elapsed, it makes no difference whether a counter increments or decrements. The effect is the same - a value differs by X from when you started so why do you care? You are going to subtract one number from another to find the elapsed time so the direction it counts is irrelevant.

What this means is stop worrying about trivial details and use the facilities available to get the job done. It would have been completed hours ago if you had not gotten hung up on details.
Rick York 3-Nov-19 15:57pm View
Do you have a definition of what constitutes a word? Typically there are delimiters that define the boundaries for a word. They would be things like whitespace and punctuation characters. Given you have delimiters defined, you might find the strtok function to be useful. I have.
Rick York 8-Oct-19 11:23am View
In the past, array sizes required a constant expression to set their size. As Mr. 0x1AA noted, it seems that is no longer a requirement.
Rick York 8-Oct-19 11:23am View
In the past, array sizes required a constant expression to set their size. As Mr. 0x1AA noted, it seems that is no longer a requirement.
Rick York 7-Oct-19 18:41pm View
I am surprised this even compiles because of how the variable T is used.
Rick York 5-Oct-19 13:10pm View
"such that A[j] divided by A[i]."

What does that mean?
Rick York 3-Oct-19 10:49am View
How in the wide world of sports do you expect anyone to be able to help you with this description of your problem?

Here's my solution : make it work.
Rick York 27-Sep-19 13:40pm View
The logic is all hosed now. The loop braces are not where they should be at all. This solution just does not apply any more.
Rick York 24-Sep-19 2:31am View
Thank you sir.
Rick York 22-Sep-19 18:50pm View
On second thought, I should have made the StringMap object a member of the Snake class instead of an argument to its methods.

Making that modification will be left as an exercise for the reader. :)
Rick York 22-Sep-19 11:39am View
Are you certain this is what you really want to do? I ask because an address of data in one process has no validity in any other process. In addition, if you were to put data in shared memory, two different processes would be unlikely to get the same address for the same data.

So, let's assume you have the address of your data in a string. What are you going to do with it next?
Rick York 20-Sep-19 12:01pm View
What does "pre-select" mean. This is not the terminology used in windows programming because it is ambiguous. Do you mean check the boxes? Do you mean have the focus?
Rick York 20-Sep-19 1:42am View
Please clarify what, "pre-select all cells on launching with rightArrow," means please.
Rick York 18-Sep-19 21:52pm View
Once the timer event has been serviced you can kill the timer and then you have a one-shot timer.
Rick York 17-Sep-19 18:10pm View
Do you really expect us to figure this out for you from two tiny code excerpts and nothing more than "it doesn't work?"

There are lots of sample code with custom drawn buttons here. I recommend looking at some to see how they are done. One is called FooButton and it is quite capable. I use it all the time.
Rick York 17-Sep-19 11:39am View
GetDlgItem returns a handle to a control in a dialog.
Rick York 17-Sep-19 11:37am View
WinMain was "hidden" so the CWinApp class would be the primary instantiation. For the most part, they removed all need for exposing the message loop so there is no need to have WinMain exposed either. This is true of WPARAM and LPARAM also because the vast majority of message handling methods are passed useful types and not the "raw" values of the types WPARAM and LPARAM. DWORD_PTR and its siblings were added for portability purposes. One can write code that compiles in 32 and 64-bit modes without changes or ifdefs. I have a lot of code that can do this. These days I really don't need 32-bit code though since I use only 64-bit OSs.
Rick York 17-Sep-19 11:18am View
google is your friend. You should be able to search for one just as well as anyone else can. There are also examples to be found on this site.
Rick York 13-Sep-19 11:03am View
POV-Ray is very cool if you like computer graphics and ray tracing. I am into both quite a bit. I wrote a reader to load POV-Ray files into my OpenGL app that can display them in real-time. I had never seen this voro++ site and I like the graphics so I am now importing the files generated by the example programs there. They are pretty cool. Thanks again for the link. :)
Rick York 12-Sep-19 10:54am View
I have added a solution below for you to consider.
Rick York 11-Sep-19 23:03pm View
Did you look at the sample code - in Examples/Interface ?
Rick York 8-Sep-19 21:52pm View
Thanks for the link. There is some very interesting stuff there.
Rick York 6-Sep-19 23:47pm View
If that matters you could use timeGetTime() and get milliseconds. The chance of the program starting twice in the same millisecond seems exceedingly remote to me.
Rick York 6-Sep-19 10:37am View
Very true! :)
Rick York 4-Sep-19 16:23pm View
I can see why because there is no question here. All we have are a series of observations. You have not posted the question.
Rick York 4-Sep-19 16:06pm View
You removed the prefixes from what? They were in several places. You have to be very, VERY specific in your descriptions.

I am not even going to try to guess what the problem is until you update the original question with your current code.
Rick York 4-Sep-19 10:38am View
Edit your question and place the updated code in there so we can see you did.

You have the same errors offset by a few lines. It appears that you did not do what I suggested or those errors would be gone. Which part of what I suggested did you try?
Rick York 27-Aug-19 13:30pm View
Nice example except the text talks about the discriminant while the image shows the determinate.
Rick York 24-Aug-19 16:40pm View
In release mode it takes 0.634 seconds.
Rick York 24-Aug-19 16:09pm View
I did it using floating point values :

calculating value for 500,000,000
result was 1.563E+42 - time was 5.812 seconds

that was in debug mode on a laptop.

double CalculateSeries( int size )
    double sum = 0;
    for( int n = 0; n < size; ++n )
       sum += ( size - n ) * Cube( (double)n + 1.0 );
    return sum;
Rick York 22-Aug-19 13:46pm View
Personally, I prefer to implement property pages with a base class known to the sheet and then no other header files. In fact, the vast majority of dialogs I write these days have no headers. Actually, I can't remember the last time I made a header file for a dialog. There's just really no need for one when all you need is a single interface function to pass in the data to edited and I define the prototype in the header that defines the data.
Rick York 20-Aug-19 2:44am View
If that library was written in C this solution needs to be adjusted a bit.
Rick York 15-Aug-19 12:11pm View
WaitForSingleObject takes a wait time parameter which can be zero so you can call it in your timer event handler if you want to and it will not wait if the time is zero.

I would write a custom process to test this with because I don't know if cmd passes back the exit code of the process it starts or not.

Does this process really have to be started with cmd? You can't just create your own console and start the process on it?
Rick York 14-Aug-19 20:15pm View
I modified your question to highlight LC0.
Rick York 14-Aug-19 12:33pm View
Look at the listing again. It tells you what LC0 is right there. I would guess LC stands for literal constant. Maybe not, but that's a clue to what it is.
Rick York 13-Aug-19 14:22pm View
Did you implement the / operator also? You have +, *, and / operations there. You might as well add the - operator also, both binary and unary.
Rick York 13-Aug-19 0:22am View
We are not here to do your homework for you but we help you with you programming questions. So, what is your question?
Rick York 11-Aug-19 12:22pm View
"Where am I going wrong?"

Exactly what is wrong?
Rick York 9-Aug-19 13:57pm View
If you are not used to this kind of stuff then you should NOT even think about going down this path because that's what is required.
Rick York 9-Aug-19 13:57pm View
If you are not used to this kind of stuff then you should NOT even think about going down this path because that's what is required.
Rick York 9-Aug-19 10:43am View
You included the surrounding and calling code but not code for the function where you claim it crashed.

You might want to consider using calloc instead of malloc because it zeros the allocated memory. Actually, since this is C++ you should probably use new[] for this.
Rick York 5-Aug-19 17:21pm View
I agree with you fully. After all the casts and such it will just be a mess.
Rick York 4-Aug-19 16:07pm View
Adjust it to use the types you want/have/need. PVOID is a pointer to void.
Rick York 1-Aug-19 17:52pm View
Why create an application dialog on the heap? That means it is a pointer and you have to use -> to access it everywhere, which you didn't do in your solution.

It could be a plain, old, stack variable just as easily if not more so.
Rick York 25-Jul-19 15:56pm View
I don't have a direct solution to your problem but if I were you, I would implement a state machine for this. It doesn't have to be a general purpose if you want to be quick about it. The reason is you can easily transition between states, you won't have a bunch of flags all over the place, and you can maintain the update timer. The state would determine when buttons are enabled and disabled. Often a few flags are adequate for this kind of thing but when you throw in enough curve balls it needs to be taken a bit farther and I think an SM would be the right way to go for you.
Rick York 23-Jul-19 19:05pm View
My best advice for you is to skip VS6 and go to VS17 or VS19. Both are free for personal use and work well in W7 and W10. VS6 is more than twenty years old now so I would be surprised if it could install itself correctly. I had problems installing VS03 and VS08 on W7. Thankfully, I don't have to use those any more.
Rick York 22-Jul-19 16:30pm View
This is the Q&A section so what is your question? So far you have written only a few observations and requirements.
Rick York 19-Jul-19 16:40pm View
Many thanks.
Rick York 16-Jul-19 12:55pm View
A rewrite of about a dozen lines shouldn't be that big of a deal. :)
Rick York 11-Jul-19 11:23am View
"sorry there will be no code to show you"

And there will be no code provided for you.
Rick York 28-Jun-19 11:40am View
No. It doesn't.

Rick York 20-Jun-19 11:47am View
Is it really so difficult to spell the word please?
Rick York 18-Jun-19 18:42pm View
I am surprised this even compiles. I always use WL 4 and this definitely would not. When you pass a std::string to a variadic function you need to call its c_str() method.

Why do you have a vector of 1.1M strings declared when you expect 500 lines in your file?

Are you sure your .CSV file is well-formed? I ask because if you have an empty entry which is two adjacent commas (,,) then strtok will skip over them both and null them. You will receive nulls from the calls when it runs out of tokens. For this reason, I think strspn is a better function to use for this because it does not null the delimiters it finds. It returns an index to the first one. Given this index, you can null them yourself after you have examined them and this lets can correctly handle empty fields in case you have them in your file(s). If you are processing output from Excel then there is a good chance you will get them.

As Richard stated, your best bet is to use the debugger and see what is going on.
Rick York 16-Jun-19 18:45pm View
To paraphrase Mr Griff, slap a semicolon on the end and off you go. The rest of it's I/O.
Rick York 12-Jun-19 10:51am View
If you do a search for console here you will find several articles that describe how to control the color of output to a console.

I don't think you want or need to call system to do that.
Rick York 12-Jun-19 10:49am View
One more suggestion : save the values in binary form, not ASCII. This way you don't have to convert them to their binary value so often. You can convert them once and store them like that. Since x is a special value you can save it in its binary form also which is 120 and that should probably get a constant definition. This means your values will range from 0 to 9 and then the X value, 120 - all in binary.
Rick York 11-Jun-19 16:09pm View
To me, it means other things actually, but I was trying to be polite.
Rick York 11-Jun-19 12:19pm View
You might have better success if you STOP YELLING AT US!!!
Rick York 10-Jun-19 11:24am View
I disagree. The algorithm I mentioned could be used to do exactly what you are after. There are other similar algorithms that might be useful there also.

You can either keep looking for code that has solved the problem or you can dig in and write it yourself. There are plenty of sites that show the minimal packing. You can write an algorithm that determines the best orientation for the packing. We're not going to do it for you. We have plenty of fun stuff to work on of our own.
Rick York 7-Jun-19 14:08pm View
Have a look at Wykobi ( It is a computational geometry library with a whole bunch of useful algorithms like finding the closest point on a sphere. It could be very useful for you.
Rick York 4-Jun-19 16:06pm View
Have a look at GDI+.
Rick York 29-May-19 16:04pm View
We are not here to write your code for you. We are here to answer questions about your code. You have not shown any code so it is difficult to answer any questions about it.

What is a constraint for a row or column?
Rick York 23-May-19 0:56am View
You have made three statements. This is the Question and Answer section of the forum. Do you have a question?