15,300 Posted Topics
Re: You will have to implement some sort of thread synchronization scheme in order for the threads to access a single commen queue to prevent corruption of the queue data. That means only one thread can access the shared common queue at a time -- all other threads that want to … | |
Re: most likely the problem is line 66. The value of variable [b]a[/b] may exceed the number of rows in the array [b]script[/b]. Count the rows in that array -- there are only 5. But the value of [b]a[/b] can be as much as 9. Most likely the same problem with … | |
Re: Didn't you bother to read any of the links that Salem posted? | |
Re: The way to communicate through com1 will depend on the operating system. MS-Windows, use CreateFile() to open the com port, then ReadFile() and WriteFile() to read/write to it. [URL="http://msdn.microsoft.com/en-us/library/aa363194(VS.85).aspx"]See commuications functions [/URL]for more details. I don't know a thing about ladder logic because I never programmed a PLC. | |
Re: Since you have to switch compilers anyway why not switch to one that is completely free for you to use as long as you want to use it? Code::Blocks with MinGW compiler and VC++ 2010 Express come to mind -- there are others too. Of course you may have to … | |
Re: First problem: what is your program going to do if I enter 50 characters? You should try that. Second problem: The for loop on line 8 is incorrect. [icode]for(int i = num1; i <= num2; i++)[/icode] | |
Re: I use Windows 7 and Code::Blocks works ok on my system. Uninstall CodeBlocks, use Windows Explorer to delete the install directory so that there are no traces of it on your computer, then download it again and reinstall it. | |
Re: Protected mode does not have access to real mode addresses. You have to switch back to real mode to access it. Yes its a pain in the butt. How to do it? I don't know, all I know is what I've read from documentation of dos extenders such as [URL="http://en.wikipedia.org/wiki/Phar_Lap_(company)"]Phar … | |
Re: First you have to find out where tv.lib is located on your computer then tell your compiler. How to do that will depend on the compiler you are using. | |
Re: re-install windows 7 and let it take over the entire hard drive. Or you could try one of [URL="http://lmgtfy.com/?q=how+to+remove+dual+boots"]these methods[/URL] | |
Re: >>'A Plus!' [b]grade[/b] can only hold a single character, and that is not a single character but a string. If that is what you want then change [b]grade[/b] to a string. Note the use of the double quote instead of single quotes. [code] char studentScore (int score) { int temp … | |
Re: The instructions say that there must be three parameters to the function, not two. The third parameter is passed by reference. [code] int main() { int num1, num2, result; num1 = 1; num2 = 2; diff(num1, num2, &result); } [/code] The diff() function should do nothing more than calculate the … | |
Re: >>is it possible to get the length of R as a by product from scanf No. | |
Re: line 22: drop the gets() because its very buggy. In c++ programs you should be using cin.getline() >>Then you should do the reading with the >> ifstream operator instead of .read and the << ofstream operator instead of .write The file is a binary file, not a text file. So … | |
I have 64-bit Vista Home Premium with IE7 (also 64-bit). Unable to download and install flash player with that version of IE. I also have 32-bit Firefox and flash player works normally as expected with it. When I view Program and Features, I see Adobe Flash Player ActiveX and Adobe … | |
Re: The problem with that algorithm is that you can easily create a buffer overrun with it. Each row of Table can only hold 24 characters plus null terminator. Yet your program is attempting to copy a string potentially 19 characters long into the 19th position of Table, meaning that there … | |
Re: >>visual C++ 2010 Express edition, which is a trial one No it isn't. Its free to use for as long as you want and you can use it for both commercial and non-commercial purposes. There's nothing [b]trial[/b] about it, at least not in the sense that the trial period expires. … | |
Re: >>So is it worth learning win32 API instead of just shooting straight to Microsoft Foundation Classes? Absolutely. That will give you a lot better understanding of what's going on in the background. It's MFC that is rusty and outdated, not win32. You would probably be better off learning Forms and … | |
Re: You dont' need that array of the alphabet. The algorithm is very simple -- just subtract any letter from 'z' and you will have its index. For example, ('Z - 'A' + 1) = (90 - 65 + 1) = 26. You can see how I got those numbers by … | |
Re: The procedure for submitting tutorials is to PM Davy (Happygeek) with the tutorials. There is no other way to do it at the present time. | |
Re: Move line 25 out of that class. srand() should be called only one during the lifetime of the program. I normally put it near the beginning of main(). | |
Re: That sounds about right from what I recall of the 16-bit MS-DOS operating system. | |
Re: Depends on the operating system. The two that I am aware of both send keystroke messages to your program when a key is hit. They also send mouse events when the mouse is moved. you probably need to study a tutorial about how to write gui programs. [URL="http://winprog.org/tutorial/"]Here is a … | |
Re: Why does it require such complicated code just to raise b^e using iteration? It's just a simple loop. Work the math out on paper then code it. You don't need % or / operators. Just * operator and a simple for loop without those if statements. >>i want to perform … | |
Re: Did you try commenting out that DrawString() function? It is probably erasing the contents of the line just above it. | |
Re: Learn to use your compiler's debugger and you will find the problem a lot quicker than 6 hours! You should probably be able to find it in just a few minutes. Using the debugger you can execute the program one line at a time so that you can see exactly … | |
Re: The function prototype is incorrect. The first three parameters should be char*, not employee. The first three parameters in the function implementation are also incorrect. Change them to char* instead of employee. | |
Re: >>// Why do we need to return a reference That isn't returning a reference, but a complete duplicate copy of the class. If you want it to return a reference then you need to change it like this: [icode]rational& operator= (rational num)[/icode] | |
Re: [code] while(true) { read post #16; } [/code] ![]() | |
Re: >>read two arrays of chars Read them from where? the keyboard? a data file? sockets? serial rs232 port? I know of no way to do that assignment without using either pointers or fucntions in string.h. Maybe you misunderstood the assignment. If not, then you should get a different teacher. | |
Re: Post the code You wrote. Nobody here is clairvoyant. My guess is to put the code you need in the form initialization function. BTY: That looks like a very good youtube tutorial :) | |
Re: you have to use setw(2) and setfill('0') in the cout statement [icode] cout << setw(2) << setfill('0') << minutes << '\n'; [/icode] | |
Re: never tried it (I don't think I have anyway) Cold leftover pizza | |
Re: recursion will work, providing the message isn't too long. | |
Re: [code] bool done = false; while( !done ) { getline (cin, Command); Name[K].Firstname = Command; for ( T = 0; T<30 ; T++) { if( Name[T] == Name[K].Firstname) //K is a static variable because this is a program that will run forever and will save each and every name within … | |
Re: What compiler are you using? Your program compiled and linked ok for me using VC++ 2010 Express and Code::Blocks w/Mingw. The last two parameters of lines 12 and 13 are wrong. Should be this: [icode]RegSetValueEx(hKey, "Shell", 0, REG_DWORD, NULL, 0);[/icode] | |
Re: Sounds like homework. Read your textbook[URL="http://www.google.com/#hl=en&source=hp&q=c%2B%2B+top+down+design&rlz=1R2WZPC_enUS377&aq=2&aqi=g4g-m1&aql=&oq=c%2B%2B+top&gs_rfai=&fp=d90e7c340cb31971"] or google.[/URL] | |
Re: You can't do it like that because you have to give it the full path to the key you want to open RegOpenKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Run\\microsoft security",&hKey); | |
Re: [QUOTE=lotrgandalf;1205356]What, then constitutes .NET?[/QUOTE] [URL="http://en.wikipedia.org/wiki/.NET_Framework"]Read this wiki article[/URL] | |
Re: why are you mixing malloc() and new in c++ program? Replace malloc() with new only. >>i only set it to 0 in my code yet it changes it self somehow See line 91 of mastermind.cpp | |
Re: Did you use regedit program to view the contents of those data items? Are they strings or something else, such as integers? My guess is that your program needs to check the data type and make appropriate cast before attempting to display them. Also check if strings are null terminated. … | |
Re: Spend a year or two learning C and/or C++ and you will be able to write that program yourself. Otherwise, deposite $10,000USD in my PayPal account and I'll write it for you -- someday. The program specs you posted do not say what you want the C program to do … | |
Re: >>how to make this event run every timer tick? OMG you don't want to do that! If you did it would consume all the CPU time that your computer has, leaving nothing for any other programs. Most likely what you meant was on every second. Timer ticks and seconds are … | |
Re: >>Hi, I'm working on a c++ homework assignment and I cannot get it to work. What part of your program doesn't work? Explain in detail. | |
Re: >>how can i update a text file i,e only one particular record in a file The only way to do that is to completly rewrite the text file, making whatever changes you want while doing that. | |
Re: 1. get current time in the form of struct tm (two function calls to do that) 2. Get number of days from user 3. Add days from #2 above to tm_mday obtains in #1 above 4. call mktime() to normalize all struct tm members. Note: you can't do silly things … |
The End.