279 Posted Topics
Re: On unix or windows you could use libcurl. marco: What's the windows one-liner? | |
Re: Firstly, you shouldn't mix tabs and spaces or you get badly formatted code. To solve your problem, it would be easiest to set the array element to -1 instead of 0 in "recursive". This means you will have to change the previous "else if" clause to [code] else if (copyArray[x][y] … | |
Re: I believe you can put this in main.h: [code] extern CAMARA camera; extern OBJECT *obj; // should probably be a longer name for a global [/code] and then in main.c you just put [code] CAMERA camera; OBJECT *obj; [/code] | |
Re: It is ridiculous to use memset to set a single character! It is also odd to dynamically declare memory (for pass and user) when you could just use automatic variables. As for LogonUser, you need to declare a HANDLE (not a PHANDLE) to recieve the user token. You pass it … | |
Re: Use fscanf instead of fgets and strtok. E.g.: [code] float a, b, c, d; int n; char str[100]; while (EOF != fscanf (file, "%d %f %f %f %f %s", &n, &a, &b, &c, &d, str)) printf ("%d %.1f %.1f %.1f %.1f %s\n", n, a, b, c, d, str); [/code] | |
Re: Here's a fix for your "incompatible pointer type" error. [code] strings = (char **) malloc (total_str * sizeof( char *)); for (i = 0; i< total_str; i++){ strings[i] = (char *) malloc (STR_LENGTH * sizeof(char)); } [/code] And of course you can malloc an array of structs. BTW, when you … | |
Re: The arity and precedence of operators is fixed by their standard usage in C++. So / needs two parameters. | |
Re: [QUOTE=billchow24;802047]Place all the nodes in odd positions before those in even ones. For example, the list {a, b, c, d, e} will become {a, c, e, b, d}[/QUOTE] Create two empty lists, listOdd and listEven. Create a bool "toggle" initialized to false. Loop through your original list, placing the element … | |
Re: You can replace your entire switch statement with [icode]table[lattice[i][j]][1]++[/icode]. By the way, you are using [icode]++[/icode] and [icode]--[/icode] incorrectly. It is NOT [icode]a = a++[/icode], but simply [icode]a++[/icode]. As for the segfault, it may be because of the way you are using rand(). Try changing everywhere it says [icode]rand() / … | |
Re: Try SRCCOPY in your first BitBlt. Look into other modes if that doesn't do what you want. Also check out TransparentBlt which allows you to have a transparent rgb color. | |
Re: I don't know if this is the problem but check your variables "handle" and "handle2" everywhere you use them. If it still doesn't work, then what exactly do you want it to do and what is it doing? | |
Re: You need to increment the array index to point to the next element for each character read. Here's an example. [code] #include <stdio.h> #define SIZE 1000 int main() { int c, n, i; char a[SIZE]; FILE *file; file = fopen ("filename.txt", "r"); n = 0; while ((c = getc (file)) … | |
Re: Your GetMin algorithm looks okay. You should post more code. The problem could be in Smallest4 or with the initialization of your matrix. | |
Re: Extraneous semicolons are fouling up your logic. Remove them. [code] else (trump == "S" || trump == "H"|| trump == "A" || trump == "D")[color=red];[/color]{ //Won Enough score= 30*(numTricks-6); } if (trump=="NT")[color=red];[/color]{ score=20*((numTricks-6)+(10)); } [/code] | |
Re: ajhais, It should actually be a Breadth First Search (BFS), not a DFS. | |
Re: What if there are two or more spaces between two words? So you should skip any initial and final spaces, and count any intermediate spaces as one even if there are more than one. And then add one (as long as you found at least one non-space on the line, … | |
Re: new returns a newly allocated address pointing to enough memory to hold a name structure. BTW, your use of the word "member" threw me off at first because the members are string, next, and value, which don't enter into your question. | |
Re: There should be an option to not create a console window for a "console" program. There is in Dev-C++ (with gcc). | |
Re: csurfer makes an important point about testing only up to the square root of num. It will actually reduce the number of comparisons to much less than half. For example, with the number 101 you only need to test up to the number 10 -- quite a savings! To reduce … | |
Re: What operating system are you running this on? | |
Re: That's not Aia's code, and it seems to be incorrect. Here's a working example. It lacks proper error checking for strtol, though. See the link in Aia's post above for the scoop on strtol. [code] int main (void) { char *number = "1234.56"; char *decimal; long int fraction = 0; … | |
![]() | Re: It's been printing the number correctly all along. Since there are 33 zeroes after the decimal point before the 626 part, you get (approximately) zero! Use "%e" to print the number in exponential notation, or "%g" to print it in whichever is more compact. As for "%lf" it is best … |
Re: This seems to work just fine: [code] #include <stdlib.h> int main() { system("move \"folder 1\\test.txt\" \"c:\\test.txt\""); } [/code] | |
Re: It's unclear what you wish to do. Do you expect the user to enter a single character? If so there is nothing to count (it's ONE character). So I'll assume you expect the user to enter more than one character and you are trying to count how many of each … | |
Re: In [icode]num=((int)ceil(((double)rand()/RAND_MAX)*(max+1)))%(max+1);[/icode] You are dividing and modding at the same time. You need to choose one or the other. With division (and floats): [icode] num = (int)(((double)rand() / (RAND_MAX + 1)) * max);[/icode] or with modding (and ints) [icode] num = rand() % max;[/icode] These both give between 0 (incl.) … | |
Re: You have [icode]maze_in.get(ch) >> maze1[i][j];[/icode] It should be more like [icode]maze_in.get(ch);[/icode] [icode]maze1[i][j] = ch;[/icode] or [icode]maze_in.get(maze1[i][j]);[/icode] Also, maze1 may be better as type char instead of string. |
The End.