155 Posted Topics
Re: This is a highly talked about subject. Its interesting that I very recently tinkered with Font rendering using OpenGL and GLUT. If you don't mind using open source libraries to link to your code, then this code might help you out. You can copy/paste this code straight into gcc, link … | |
Re: Your question is incomplete. What list? What type? There are many types of lists. | |
Re: [QUOTE]buffer[i]=buffer[i]-x;[/QUOTE] This is encryption? In what country? He is trying not to laugh. | |
Re: Read a physics book. The number of unanswered questions in there will keep you busy for the rest of your life. | |
Re: I think this might be a miscommunication issue rather than someone being lazy, although its very possible that [COLOR="Red"]Narue[/COLOR] is correct. Either way, I am tempted never to judge someone completely based on how they ask for help. The audience of this site seems to be largely non-english speakers and … | |
Re: [COLOR="Red"]@creeps[/COLOR] A few comments... [b]>First of all, you are not including a header file, therefore, you have no access to the I/O functions (i.e. scanf ).[/b] This is an interesting observation, considering he probably only copied the main part of the function and not the whole file. Especially considering that … | |
Re: I wish I could get amnesia and relearn C. It was so much fun the first time, and I miss the days when things were so new and exciting! This is your code with some comments. [code] #include <stdio.h> int main(void) { char stars[]= "*******", spaces[5]=" "; // You are … | |
Re: If [b]malloc()[/b] is crashing instead of returning NULL then you have a memory overrun somewhere else in the code which is messing with the [b]malloc[/b] runtime table. You might need to retrace your steps and figure out where the memory overlaps are occurring. I don't see anything wrong with your … | |
Re: I second [COLOR="Red"]Ancient Dragon[/COLOR]'s comment. I am surprised that IBM's documentation does not say that it's use is non portable for the C language. Frankly I would not recommend you use that syntax unless you know for sure you will never port your programs to other platforms. | |
Re: You are posting in the wrong forum, this is for questions regarding C language specific problems. But either way, I'd suggest you go through this documentation carefully and maybe it will help your issues, specifically the installation instructions: [url]http://www.gnustep.org/resources/documentation/User/GNUstep/gnustep-howto_toc.html[/url] | |
Re: In low level communications applications between the UI and hardware, its [b][i]ESSENTIAL[/i][/b] to check every error message you get from your control commands. Can't tell you how many hours you could save just by logging everything that occurs at each stage of processing. It might not seem important now but … | |
Re: I think you just need to make the SQL string dynamic, is that your problem? If so... [code] wchar_t SQL_Query_String[512]; int DateEncoded = 14092010; swprintf(SQL_Query_String, 512, L"LOAD DATA LOCAL INFILE 'C:/RECORD%d.txt' INTO TABLE test FIELDS terminated by ','", DateEncoded); [/code] | |
Re: [b]> the solution given for bubble sort is vast. can anyone help me with a shorter one??? [/b] :$ silly rumi, nothing in this entire post is vast, except perhaps the silence caused by those shaking their heads at your question. | |
Re: I don't completely understand your question, but lines 4->7 define the LLIST structure, which appears to be a linked list. Line 28 creates a pointer for the first element of a chain of LLIST's. list_add() appears to create some memory for an instance of an element of a linked list … | |
Re: As was said about 7 years ago, anywhere where the word [b]SIZE[/b] is found, it is replaced with [b]10[/b]. There is no type or rules or anything. [code] #define [COLOR="Red"]SIZE[/COLOR] 10 int a = [COLOR="Red"]SIZE[/COLOR] [COLOR="Red"]SIZE[/COLOR] 2 + 2; int *b [COLOR="Red"]SIZE[/COLOR] = [COLOR="Red"]SIZE[/COLOR] &a [COLOR="Red"]SIZE[/COLOR] [COLOR="Red"]SIZE[/COLOR] [COLOR="Red"]SIZE[/COLOR]; [COLOR="Red"]SIZE[/COLOR] [/code] … | |
Re: I strongly believe the best way to learn to program in the field of robotics is from the ground up. In other words, learn how the hardware ties in to the high level software engineering and only then get into the subject of how to control the mechanics with high … | |
Re: You also need to initialize j = 0 in the for loop of [b]displayData[/b] | |
Re: You are asking [b]fscanf[/b] for a [b]%d[/b], which is a decimal integer. You are giving it a pointer. The random numbers are probably pointers getting resolved to decimal integers. Looks like you did it correctly in the [b]printf[/b] function. Not sure why you got two sets of parenthesis around your … | |
I have a weird problem and I want to know if any of you have any ideas on how to fix this. If I do this... [code] swprintf(Dest, 500, L"G%sY", "AMEDA"); [/code] [b](wchar_t*)Dest[/b] contains the following text... [TEX]GAMEDAY[/TEX] But if I do this... [code] swprintf(Dest, 500, L"G%sY", L"AMEDA"); [/code] [b](wchar_t*)Dest[/b] … | |
Re: Untested, but throwing it out there to give you an idea of the direction of where my mind is going. [code] // User input for number of rows int r; printf("Enter the number of rows: "); scanf("%d", r); // User input for number of columns int c; printf("\nEnter the number … | |
Re: I can't think of any library function that could do this, but you can always put these named functions into a shared library and use something like [b]dlsym()[/b] and access them with a string containing the function name. Shown here is an example. It shows you how you can also … | |
Re: Let me get this straight. So you want to prove to your peers that one technique is faster than the other, yet you are having trouble making the technique you are bragging about function correctly? Maybe its because the technique is flawed. You see, multiplication in C using the multiplication … | |
Re: [COLOR="Red"]@Adak[/COLOR] Your right. Pointers make me salivate. [COLOR="Red"]@advait_123[/COLOR] [code] c=(int**)malloc(x1*sizeof(int*)); for(i=0;i<x1;i++) *(c+i)=(int*)malloc(y1*sizeof(int)); [/code] Highly inefficient. [b]malloc[/b] wastes tons of CPU to do its job, so use it as little as possible. I'd suggest making one big array and performing math to divide it into rows and columns. Its faster than … | |
Re: Those functions are exposed by the chipset you are trying to control in this way. Not sure how or if the Operating system would get in the way of sending those OP codes to those target devices without writing a driver that bypasses those restrictions or using an existing one. … | |
Re: This website should be renamed to "Free & Easy Homework Answers" | |
Re: [b]1. Is it always necessary for a return value of main() to be an integer.[/b] In C, the compiler may allow [b]main()[/b] to return a void, but its behaviour is undefined and therefore its highly not recommended. As a reference, the C++ standard explicitly prohibits returning void, and some compilers … | |
Re: You can't use the same name of the enum's within the same scope. when you do this: [code] typedef enum A { enum1, enum2, enum3 }; [/code] its about the same as doing this: [code] const int enum1 = 0; const int enum2 = 1; const int enum3 = 2; … | |
Re: [COLOR="Red"]Ancient Dragon[/COLOR] pretty much answered the file and database side of the question. Just wanted to add that if the numbers are strings, you need to convert them to integers with either the MySQL library functions (to read a field as an integer), or convert it with something like atoi(). … | |
Re: Lots of weird things going on in this thread, but I don't care if its a trap or not, I saw horrible code and like a magnet I had to fix it! So maybe there is some use to this function for someone else. I made this code literally in … | |
Re: For dynamically sized arrays in C, your friend is the [b]realloc()[/b] function. But instead of [b]int a[5][/b], you must use [b]int *a = malloc(5 * sizeof(int));[/b]. Only then can you use the [b]realloc()[/b] function to resize the array. In other words... [code] int *Array = (int *) malloc(3 * sizeof(int)); … | |
Re: I haven't worked with linux driver programming at this level just yet, so some of the functions and conventions are unfamiliar to me. So with that, I have an observation which you may correct me on if I'm wrong. In [b]memory_write()[/b], you have [b]tmp=buf+count-1;[/b], and please correct me if im … | |
Re: "I make a program..." then "...what is code for that plz" So you made it, yet at the very same time you want code for that. While you were writing that sentence, you traveled back in time and need the code you wrote earlier in that sentence. Now, as someone … | |
Re: I am interpreting your question in one of two ways: (A) You are a genius, way beyond learning how to use existing database architecture. Still, given the C genius that you are, you need some advice on how to construct a database engine from scratch. (B) You are a flat … | |
Re: This may be some help. Below is the code inside [b]conio.h[/b] for [b]clrscr()[/b]. [CODE] void clrscr (void) { DWORD written; int i; __fill_text_info(); for (i = __CONIO_TOP; i < __CONIO_TOP + __text_info.screenheight; i++) { FillConsoleOutputAttribute (GetStdHandle (STD_OUTPUT_HANDLE), __FOREGROUND + (__BACKGROUND << 4), __text_info.screenwidth, (COORD) {__CONIO_LEFT, i}, &written); FillConsoleOutputCharacter (GetStdHandle(STD_OUTPUT_HANDLE), ' … | |
Re: It sounds like an unexpected hiccup during a migration plan of legacy code. Good times.. In situations like these, you have very few choices. Since the code in this case is called "not portable", you either (A) Make it portable or at least compatible with the target, or (B) Find … | |
Re: A few suggestions... You are not freeing the memory after you malloc it. Thats a memory leak, just for your info. Also, instead of using [b]malloc()[/b], use [b]calloc()[/b] and you don't have to do [b](*ptr)->link=NULL;[/b] One more thing... if this was an entirely recursive program, your display function should also … | |
Re: [B]> In C, you don't need to cast return value from malloc(), and moreover, you shouldn't do that. [/B] I looked over that link attached to your warning that it shouldn't be done. Its just saying that it helps prevent problems when you dont include a file. Is that a … | |
Re: The fastest way to get a response is to actually ask a question. | |
Re: Not mentioned here is compiler extensions. They are special keywords or commands, usually prefixed with double underscores, which is highly compiler specific. Using even one of these features automatically makes your code non ANSI-C compliant, unless of course you surround such code within preprocessors which block that kind of code … | |
Re: Oh jeez, this is entirely the realm of assembly language. Why don't you use [b]asm{}[/b] to get this done in like 15 lines of code or less? You can take advantage of the CPU zero and carry flags in byte shifts there. | |
Re: I usually don't even bother with the C array's. I go straight to the point and access the array's member directly. That way I make my own rules to how I index my array. Many situations call for many types of arrays, and I find the C array a bit … | |
Re: I know I'm supposed to help you with your code, but the extreme inefficiency was killing me. A procedure like reversing a string can be used in many recursive situations and therefore must be as fast as possible. So here is some code I made which takes a string and … | |
Re: Made this in a hurry, but it should work. Requires the math header. Basically you take the numbers you want to compare, multiply them by 10 to the power of your precision, trim them by casting to int, do your comparison, and your done. [code] inline int CompareDoubles(double A, double … | |
Re: Don't use structures before reading the data, create a program to parse the data and load them into your OWN structures which you made. So you read the blocks of data one known element at a time, and only copy the data you NEED for your program into your structures. … | |
Re: I haven't reviewed the whole code, especially since its got no indentation and its not in code tags, but the first error is happening because you have your testnumber() function defined AFTER you first used it. The compiler doesn't know what testnumber() is unless you at least declare it before … | |
What do you guys think is a good way to deal with this situation: [code] #define TYPE_INT 0 // 4 byte, signed #define TYPE_CHAR 1 // 1 byte, signed #define TYPE_UINT 2 // 4 byte, unsigned #define TYPE_FLOAT 3 // 4 byte, signed, floating point typedef struct { float Value; … | |
Re: I use the expat library in my application. [url]http://expat.sourceforge.net[/url] Its robust, easy to use, open source, and recommended by the XML organization. I highly recommend it. It uses callback functions, so what you do is open your file with fopen, then loop through each character and feed it to [b]XML_Parse()[/b] … | |
Re: I'm not sure if I'm reading this correctly. Was a post answered in 2005 bumped to 2010 asking the exact same question as the original poster in the same exact words even though the post was already clearly answered? Does this happen often on this forum? | |
Re: I have never had this problem. Whenever I need a keycode for anything, I make a tiny utility (or hack the existing program) so that it spits out the keycode in a message box when I press the key or use charmap.exe. Are you looking for a macro or something? | |
Re: Well, if SQL plus offers a C library, learn to use it, or just use an ODBC library to connect to it. Those are really your two best options. To find out if they offer a library, search their documentation for developer tools and read up on how to connect … |
The End.