255 Posted Topics
Re: You're right, that's different from: [CODE=C]char sudoku[] = { '0', '0', '1', '0', '0', '0', '0', '0', '9', '6', '0', '8', '7', '9', '4', '0', '2', '0', '0', '0', '9', '1', '0', '5', '0', '0', '0', '0', '0', '0', '6', '7', '0', '0', '0', '2', '0', '8', '0', '0', '0', … | |
Re: [CODE=PHP]// Get file name from URL and remove any bad filename chars. $url_parts = explode('/', $url); $num = count($url_parts)-1; $file_name = $url_parts[$num]; $badchararray = array(" ", "'", "\"", "$", "&", "%", "-", "#", "^", "*", "(", ")", "~", "@", "/", "?", "="); $file_name = str_replace($badchararray, "", $file_name); $file_name = stripslashes(strtolower($file_name)); … | |
Re: [URL="http://www.daniweb.com/forums/announcement118-2.html"]http://www.daniweb.com/forums/announcement118-2.html[/URL] If people would READ once in a while, we would all be spared a whole lot of trouble. | |
Re: [CODE=C] struct termios chk_options; tcgetattr(fd, &chk_options); if(chk_options.c_cflag & CS8) printf("Eight bit mode\n"); [/CODE] A list of the other flags are [URL="http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap11.html#tag_11"]here[/URL] (11.2.4 Control Modes) | |
I am making some software to analyze digital sound data. My first step is to find where all the attacks are, or where the starts of notes are. I want to find where there is a significant increase in volume, working with both relative and absolute differences. The difficulty with … | |
Re: Using system() commands is not a good idea, and windows specific functions are not a great solution either. You can use [URL="http://cplusplus.com/reference/clibrary/ctime/clock.html"]Clock()[/URL] instead of sleep. Also, check out these [URL="http://www.iu.hio.no/~mark/CTutorial/CTutorial.html#Special%20Control%20Characters%20again"]special control characters[/URL] as a way of clearing the screen. | |
Re: How about [URL="http://msdn.microsoft.com/en-us/library/ms646293(VS.85).aspx"]GetAsyncKeyState[/URL]? (windows specific function) | |
Re: Can anyone else not stand the attitude of some people that the world owes them something and they should complain and make a scene until they get it? | |
Re: Another solution (I know, you see this one all the time): don't use scanf or it's partners. If you use low level input functions and do the converting yourself, you have much more control over what you can do. | |
Re: I would recommend using a [URL="http://en.wikipedia.org/wiki/Bubble_sort"]bubble sort[/URL] with the [URL="http://cplusplus.com/reference/clibrary/cstring/strcmp.html"]strcmp[/URL] function as a comparison. | |
Re: When printing the form, just put the PHP variable in the "value" attribute of the input field. | |
Re: Does your teacher explain anything else about making the graph? You can make a table of sorts in a console screen. | |
Re: Instead of this: [CODE=c] for(b = 1, m = len; m > k; m--) { // 1 2 4 8 16 32 64 128 ... place-values, reversed here b *= 2; } // sum it up sum = sum + n * b;[/CODE] Include <math.h> and replace your the previously … | |
Re: grep stands for global / regular expression / print. First try a search on a way of performing regular expressions in C. Then find a good tutorial on how those work. | |
Re: Can you include some variable declarations? Otherwise I can't understand how [CODE=C++]door[door][/CODE] even compiles. | |
Re: If you really want to, you could write C libraries that mimic java code, as well as many other languages. It would work best in C++ however, which provides a lot of functionality for class-based designs. Most important here, i would think, is operator overloading. | |
Re: I think what you want to do is just return the one or zero rather than a struct. The operation can be passed as a pointer to a char (in the parameters). a, b, and c don't need to be pointers. | |
I am having some trouble with the layout of my project. I'm using several APIs, including the WinAPI and DevIL. I had hoped to encapsulate each one in a separate header file, so that the main program would never have to know whats going on. The problem is, some functions … | |
My application creates a window in the main thread, but I want the message loop in a separate thread. Is there any way to catch the messages from that window while an another thread? I tried giving GetMessage that window's handle, it didn't work. I could just create the window … | |
Re: Check out GMP (Gnu MultiPrecision). It allows you to work with extremely large numbers and has wrappers for c++. | |
Re: There's a good reason why you're not supposed to feed the bears. If you give them something for free, they'll expect that all the time and won't figure out how to feed themselves. It would seem that people can be the same way... | |
Re: You will likely have to use [URL="http://msdn.microsoft.com/en-us/library/bb219802(VS.85).aspx"]DirectInput[/URL]. It provides a *sort of* simple api for dealing with any kind of input device imaginable. Sort of. | |
Re: If you want to use the $time variable somewhere else in the same page, you would be better off getting the time with PHP and then printing it, rather than using the javascript. ![]() | |
Re: Maybe you should take a look at how str_replace is used: [URL="http://us2.php.net/str_replace"]str_replace[/URL]. You have to provide something to replace 'new_ad' with. Plus, the function doesn't store the new value in the place of the source string, it returns it so you need to store that somewhere. Try: [CODE=php]$new_result = str_replace($find_ad, … | |
Re: Where is your application located? On a website? In that case have the users download (or just make it themselves) an internet shortcut to that page. If its an application that runs directly on their computer, create a shortcut to a batch (.bat extension) file with something like this in … | |
Re: Try exploding with spaces. If you know how many fields there are, (with n being the number of fields) you can say every (nth) field is last name, (nth + 1) field is first name, and so on. This does assume that individual fields cannot contain spaces as part of … | |
Re: Would you care to be a little more specific? The width of what column is increasing? And why is this a problem? HTML tables will fit to the largest width by default. | |
Re: Thanks for resurrecting an old thread that has absolutely nothing to do with your problem just to ask for someone to do your bloody homework for you. Thanks for wasting people's time. | |
Re: [QUOTE=Murtan]note that *(glblclrtab + i) is functionally equivalent to glblclrtab[i] but the second is way easier to read.[/QUOTE] Not entirely true, it is possible that the array was broken up in memory (to save space, or maybe just to piss programmers off). The first approach will not account for that, … | |
Re: Please use CODE tags. And could you post the relevant code so we don't have to wade through all of that? Try posting just where it is getting or defining the categories/subcategories and where it is adding things to a table (in a database, I assume). But without looking at … | |
![]() | Re: Umm, that sounded pretty unnecessary. Try: [CODE=c]printf("row %d sum = %d\n", r + 1, tot);[/CODE] Keep the loops the same. It will start the labeling at 1 (0 + 1) and go to 3 (2 + 1). |
Re: Submit takes me to payment.php, which doesn't exist. What file is the code you provided supposed to be for? At any rate, this is not a PHP issue. | |
Re: That massive amount of code is a huge turnoff for potential help. Can you post the relevant parts? And it would help if you could be more specific with your problem. (Not more wordy, as some people seem to think) | |
Re: printf("\r"); It may be compiler-specific, it may be platform dependent, so use discretion but give it a try. | |
Re: You can't put a button into a console. The only way to parse mouse event in one is using a bizarre Windows-specific process. You would need to use the Windows API for something like that, and it's way too much for a beginner. Try visual basic. | |
Re: Agreed. Just a wild guess, if you're using Windows, check out DirectSound (msdn, google search will serve you well). But this of course would come [U]after[/U] substantial knowledge and experience with the language. | |
Re: You are passing in to set_add variable that don't exist yet! In the beginning of your main, declare them like this: [CODE=c++] string St_address; string city, state; int Zip; [/CODE] Although your code was sort of hard to understand, the prototype for set_add said it was a mutator. But the … | |
I have the following globals defined (the relevant ones, anyway): [CODE=c] DWORD dwNumMaterials; LPD3DXBUFFER lpMaterials; LPD3DXMESH lpMeshBody; [/CODE] And the call to D3DLoadMeshFromX is here: [CODE=c] D3DXLoadMeshFromX(L"body.x", D3DXMESH_SYSTEMMEM, lpD3DDevice, NULL, &lpMaterials, NULL, &dwNumMaterials, &lpMeshBody); [/CODE] When this is called, it returns a generic error (0x80004005). Also, if it is needed … | |
Re: Several database servers (mySQL, for example) include libraries and headers for C that allow programs to access databases. You should easily be able to find a tutorial on how to do it with your choice of server. | |
I have the following globals defined (the relevant ones, anyway): [CODE] DWORD dwNumMaterials; LPD3DXBUFFER lpMaterials; LPD3DXMESH lpMeshBody; [/CODE] And the call to D3DLoadMeshFromX is here: [CODE] D3DXLoadMeshFromX(L"body.x", D3DXMESH_SYSTEMMEM, lpD3DDevice, NULL, &lpMaterials, NULL, &dwNumMaterials, &lpMeshBody); [/CODE] When this is called, it returns a generic error (0x80004005). Also, if it is needed … | |
I am making a blitting call on my backbuffer: [CODE=C++] BOOL drawImage(IMAGE *lpImage, LONG x, LONG y) { RECT rect; rect.left = x; rect.top = y; rect.right = x + lpImage->lWidth; rect.bottom = y + lpImage->lHeight; dwVideoErrCode = lpBack->Blt(&rect, lpImage->lpSurface, NULL, DDBLT_WAIT | DDBLT_KEYSRC, NULL); if(dwVideoErrCode != DD_OK) { MessageBox(NULL, … | |
I am using DirectDraw to make a game and I am running it in 8-bit color mode. What I am having a problem with is making a macro to convert RGB values into a single 8-bit color. Here is the macro: [CODE=c++] #define RGB_8BIT(r, g, b) ((r & 224) + … | |
Re: Here's the important segment of the array duplicates problem: [CODE=c++] for(int i = 0; i < 1000; i++) { for(int j = 0; j < 1000; j++) { if(i != j) { if(arr[i] == arr[j]) { return arr[i]; } } } } [/CODE] This just checks every element of the … | |
I need to find the number of elements in an array passed into a function. The problem is in this case, sizeof() returns the size of the pointer itself. It only does this when passed through to a function. So here is that function: [CODE=c++] bool matchWord(TWORD *wordList, TWORD *word, … | |
Re: I'm a referring to the original post here: On this line: [CODE]pair[k]=atoi(&argv[i]);[/CODE] You are actually passing in a pointer to a pointer while the function only takes a pointer. Remove the '&', this is whats causing a problem. | |
Re: I would make an array of strings, one element for each line. Than use something like getchar() to read in one character at a time until you find a '\n' (newline) character. Then start using the next element and read in the next line likewise until you reach the end … | |
Re: Lets please not have everyone get so offended here. Some of you people really need to chill out. In response to the code: When [U]calling[/U] a function, you don't include data types. You simply pass in the variables you want the function to use. Although I would recommend doing some … | |
Re: Maybe you should have read some of the forum rules: we aren't going to "give you" the code. Then you aren't learning which kind of defeats the point, right? Jishnu gave you an excellent tutorial to read, I was just about to suggest a bubble sort myself. Once you understand … | |
Re: You could use the WinAPI file functions ([URL="http://msdn2.microsoft.com/en-us/library/aa364232(VS.85).aspx"]http://msdn2.microsoft.com/en-us/library/aa364232(VS.85).aspx[/URL]) which allow you to set sharing permissions (as well as other flags and such for the sort of thing you described). | |
Re: This looks like it requires some library files that you didn't add. Go to the project settings, go to Configuration Properties->Linker->Input->Additional Dependencies. Add any .lib files you find with the other twofish files in this field. You may have to add the folder they're in to Configuration Properties->Linker->General->Additional Library Dependencies. … |
The End.