155 Posted Topics

Member Avatar for tomtetlaw

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 …

Member Avatar for N1GHTS
0
1K
Member Avatar for bflack
Member Avatar for N1GHTS
0
294
Member Avatar for pro_rocky

[QUOTE]buffer[i]=buffer[i]-x;[/QUOTE] This is encryption? In what country? He is trying not to laugh.

Member Avatar for pro_rocky
0
289
Member Avatar for Rahul.menon

Read a physics book. The number of unanswered questions in there will keep you busy for the rest of your life.

Member Avatar for gaurav_13191
0
93
Member Avatar for abhiab1991

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 …

Member Avatar for abhiab1991
1
133
Member Avatar for Snader

[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 …

Member Avatar for N1GHTS
0
131
Member Avatar for hoganmadman

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 …

Member Avatar for N1GHTS
0
95
Member Avatar for tehmarto

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 …

Member Avatar for tehmarto
0
145
Member Avatar for swapnaoe

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.

Member Avatar for swapnaoe
0
173
Member Avatar for hericles

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]

Member Avatar for N1GHTS
0
117
Member Avatar for malvi

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 …

Member Avatar for malvi
0
510
Member Avatar for unnamed17

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]

Member Avatar for N1GHTS
0
147
Member Avatar for smize33

[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.

Member Avatar for N1GHTS
-2
189
Member Avatar for westony

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 …

Member Avatar for abhimanipal
0
163
Member Avatar for JesterDev

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] …

Member Avatar for Ancient Dragon
0
4K
Member Avatar for Talguy

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 …

Member Avatar for N1GHTS
0
120
Member Avatar for konohastar
Member Avatar for konohastar
0
118
Member Avatar for DarkChewby

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 …

Member Avatar for N1GHTS
0
97
Member Avatar for N1GHTS

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] …

Member Avatar for sree_ec
0
187
Member Avatar for logicmonster

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 …

Member Avatar for N1GHTS
0
140
Member Avatar for sundip

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 …

Member Avatar for sundip
0
259
Member Avatar for ceatkin2

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 …

Member Avatar for N1GHTS
0
242
Member Avatar for advait_123

[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 …

Member Avatar for N1GHTS
0
103
Member Avatar for Auraomega
Re: DVFS

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. …

Member Avatar for N1GHTS
0
128
Member Avatar for eman 22
Member Avatar for N1GHTS
-1
102
Member Avatar for Kakashi Hatake

[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 …

Member Avatar for pro_rocky
0
122
Member Avatar for hanvyj

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; …

Member Avatar for hanvyj
0
6K
Member Avatar for unnamed17

[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(). …

Member Avatar for unnamed17
0
121
Member Avatar for prasanthsagar

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 …

Member Avatar for N1GHTS
0
313
Member Avatar for gju

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)); …

Member Avatar for abhimanipal
0
126
Member Avatar for onus

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 …

Member Avatar for N1GHTS
0
201
Member Avatar for mmmm1118
Re: C

"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 …

Member Avatar for N1GHTS
-2
97
Member Avatar for mmmm1118

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 …

Member Avatar for N1GHTS
0
191
Member Avatar for varun mca

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), ' …

Member Avatar for Adak
0
118
Member Avatar for algarmon

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 …

Member Avatar for N1GHTS
0
205
Member Avatar for gaurav_13191

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 …

Member Avatar for N1GHTS
0
559
Member Avatar for Dazaa

[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 …

Member Avatar for sree_ec
0
178
Member Avatar for nirajs
Member Avatar for nirajs
0
167
Member Avatar for senche

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 …

Member Avatar for N1GHTS
0
996
Member Avatar for Dewey1040

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.

Member Avatar for N1GHTS
0
1K
Member Avatar for bflack

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 …

Member Avatar for N1GHTS
-1
4K
Member Avatar for onus

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 …

Member Avatar for N1GHTS
0
519
Member Avatar for karthiken07

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 …

Member Avatar for N1GHTS
0
168
Member Avatar for tusharforever

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. …

Member Avatar for tusharforever
0
302
Member Avatar for devel2000

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 …

Member Avatar for sree_ec
0
215
Member Avatar for N1GHTS

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; …

Member Avatar for N1GHTS
0
111
Member Avatar for harris21

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] …

Member Avatar for N1GHTS
0
2K
Member Avatar for PeterX

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?

Member Avatar for N1GHTS
0
258
Member Avatar for tomtetlaw

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?

Member Avatar for N1GHTS
0
91
Member Avatar for Rushabh Shah

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 …

Member Avatar for N1GHTS
0
98

The End.