155 Posted Topics
Re: atof() converts a string to a double, except in your case you are giving it not a string, but a single character. | |
Re: [QUOTE=dellat;1647999]Has the following code any practical utility apart from showing the working of pointers? [/QUOTE] Yes, that specific technique is highly employed in viruses for code injection. | |
Lets say I have a shared library in Linux, written in C, with a single function that simply returns the pointer to a string literal. [code]void *ReturnObject() { return (void *)"\xFA\x03\x44\x10\xE0"; }[/code] When this library is loaded by the host application at runtime and this function is called, is the … | |
Re: First you must pick a database. This is just a few, most of them are free: PostgreSQL: [url]http://www.postgresql.org/docs/8.4/static/libpq.html[/url] MySQL: [url]http://dev.mysql.com/doc/refman/5.0/en/c.html[/url] Microsoft SQL: [url]http://msdn.microsoft.com/en-us/library/aa936940%28v=sql.80%29.aspx[/url] SQLite: [url]http://www.sqlite.org/c_interface.html[/url] Oracle: [url]http://orclib.sourceforge.net/[/url] ODBC (Any): [url]http://www.easysoft.com/developer/languages/c/odbc_tutorial.html[/url] Then you need to link your program to it. Pick your compiler and find out how to do it. GCC: … | |
I am designing a project geared towards business and is built in C language. The design of the various interface screens are currently in XML/CSS. The target platform is a PC running linux or windows. To compile the software, I first run a source-to-source compiler which converts the XML/CSS into … | |
Re: [B]Adak:[/B] [code] if((strcmp( name, "positive" )) == 0); //note 6 parenthesis if( strcmp( name, "positive" ) == 0); //note 4 parenthesis [/code] Since [B]strcmp[/B] is not a macro, there is no compile difference between those two lines. Why do you add the extra parenthesis? | |
Re: I am confused at this thread. An operating system is nothing special. It is just a platform for which software can run in a target hardware. Beyond that: its a methodology, a strategy, a concept. I have yet to read any philosophy or goal beyond simply reinventing the wheel. Why … | |
Re: Here you go YAMNA MIDHAT! I hope you one day get a job at Microsoft. [code] #include <textedit.h> #include <fonts.h> #include <richedit.h> #include <intrface.h> int main(void) { TextEdit TextEditor; TextEditor.Init(); TextEditor.Default.SetFont("Arial"); TextEditor.Default.Color = TD_BLACK; TextEditor.Launch(); while (Globals.Interface.ProcessMessages()) TextEditor.ProcessEvents(); return 0; } [/code] | |
Re: [B]You need to create a program to perform this:[/B] [I]The number of digits in the positive integer x is exactly log(x) + 1, rounded down, where the log is base 10, or you could write ln(x)/ln(10) + 1, rounded down. (Of course, if x is not a perfect power of … | |
Re: [quote]I can understand at how geniuses feel ( but i dont belong to the geniuses.....I'm just a normal guy^^) [/quote] I finally understand Narue's avatar. It is so appropriate for this thread that I am attaching it to this message. KOFguru, I have a strong feeling that you are out … | |
Re: [code] switch (2) { int x = 10; case 2: printf("Case 2: %d\n",x); break; } [/code] Is the same as... [code] goto 2; int x = 10; 2: printf("Case 2: %d\n",x); [/code] Which is the same as... [code] printf("Case 2: %d\n",x); [/code] And since x is not initialised with any … | |
Re: I have had situations where I needed to graph a complex mathematical model for some application, such as compression, encryption, image, and number theory analysis. I honestly didn't think there were programs out there that do this kind of thing. What I would do instead was just make a GUI … | |
Re: Have you read this? It might help. [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1069894816&id=1043284351[/url] Has it worked with Windows 7 before? | |
Re: [quote]Your indentation is horrid[/quote] His indentation looks horrid, but notice that some of his lines are tabed and some are spaced. I have this problem too when copying code from an IDE where tabs are set to allocate an unconventional specific number of fixed width spaces. It makes copying terrible. … | |
Re: What programming interest specifically do you have? Device drivers? Kernel/service modules? Single/Multi-threaded? Firmware? GUI? Gaming? Demo/Multimedia? Audio? Video? Software plugins? How about project size? Project role? Project difficulty? Project depth and dimentions? How long do you want to spend on it? A role involving applying updates? Debuging? Testing? Do you … | |
Re: The conversion methods used in this thread are inefficient. Just now I created and tested two functions for you to use that perform [B][I]Binary String to Integer[/I][/B] conversion and [B][I]Integer to Binary String[/I][/B] conversion. They are the most efficient I could possibly make them. Any more efficient and i'd have … | |
I am developing an OpenGL application (mostly 2D Ortho) compiled in gcc. As a requirement, in order to offer remote online tech support for the application, I need to be able to view and control this application remotely from time to time using something like VNC viewer. I tried using … | |
Re: The answers posted in this thread are all very good. Still, here is a practical answer to your question. This is a bad way to clear memory for an enormous string: [code] char *EnormousString; EnormousString = calloc(999999999999999); [/code] It works good for small strings, but if its a precious cog … | |
I have been coding in C for a very long time, and I thought I had it all figured out, until I saw this code in an MD5 library: [code] static void MDPrint (mdContext) MD5_CTX *mdContext; { int i; for (i = 0; i < 16; i++) printf ("%02x", mdContext->digest[i]); … | |
Re: I'm a big fan of reinventing the wheel. And I'm also a huge fan of bit manipulation. First of all, I agree that if you are making a calculator program you should prepare for numbers a computer may not be able to calculate with standard types. So a bit-level approach … | |
Re: News, Wikipedia, and Wolfram Alpha. That's the only reason to be on the internet for me. | |
Re: For anyone confused on his question, he is asking about how to correctly use the SAPI in Microsoft Windows. Here is a tutorial straight from Microsoft explaining step by step how to do this: [url]http://msdn.microsoft.com/en-us/library/ms720163%28VS.85%29.aspx[/url] Here is an easy way to do it if you are using Visual Studio with … | |
Re: Here is a way to do it. Convert the [B]TestInput[/B] to your [B]scanf[/B] implementation. Also not included in this example is a main function, the includes, and the [B]free[/B] functions which free the memory created by [B]realloc[/B] and [B]calloc[/B]. [code] #define MAX_STRING_SIZE 256 typedef struct { // This structure will … | |
Re: [B]> and neither am i running the app on a pc or mac[/B] I love embedded programming! Its like crispy bacon in the morning for me. If you are running a unix/linux based OS, you could use system calls to embed the functionality of existing free or open source command … | |
Re: Wrong forum, you need to post this in the linux forum, not in a C language forum. | |
Re: I love programming for electronics. Its like watching your programs come to life, literally! [B]printf()[/B] is an awesome function, and its strange to see such code not behave properly. Here is an idea which might work in your specific implementation. Basically I use [B]snprintf()[/B] to do the work of converting … | |
Re: I haven't tested this code, I just threw it together in a few minutes. It should do everything you need, and its extremely efficient. The parameters would be like this: ./program <Number #1 hex/int/bin/oct> <Number #1> <div/add/mul/sub> <Number #2 hex/int/bin/oct> <Number #2> <Result hex/int/bin/oct> Its not a fix to your … | |
Re: I suggest you do something like this: - Create a structure to store each student's information. Maybe call it "Student". - In the "Student" structure, create another structure for each subject, maybe called "Subject". In there, set up your grade variables or arrays, however you want to set it up. … | |
Re: Can you repost your code in Code tags? It's not friendly to read without it. | |
Re: I have read this question like 10 times trying to make sense of what you are saying, but I still don't understand. [B]> The problem I have is that I can't write space in my string. > So strings like : "name fullanme" are rejected > and returns only "name".[/B] … | |
Re: If you need an explanation on the concepts of string reversing, I have a very detailed explanation in this post: [url]http://www.daniweb.com/forums/thread313164.html[/url] | |
Re: so many [B]if[/B]'s... so little [B]switch[/B]es... You should consolidate all your [B]printf[/B]'s wherever possible so that the logic can also be consolidated. I also suggest that you convert all your hard coded numbers into [B]enum[/B]erations so that its more legible. This isn't a solution, just a coding suggestion. | |
Re: I agree with the reputation comment. While I love a good challenge, especially in C, your presentation of it as a newcomer on this forum appears borderline spam. As a suggestion, don't start any paragraph in the English language with a sentence fragment such as "this is the output". The … | |
Re: [B]> Really sorry to answer to a two year old thread. I didnt look at the date just answered the thread which appeared at the top. [/B] No worries, It happens to the best of us. Its interesting to see so many questions that pop up occasionally on the subject … | |
Re: [B]void[/B] is a special type which is like a place holder for any type. [B]void[/B] pointers are used as a kind of "incomplete cast" which allows you to store values without first specifying its type, but you must later specify its type by casting before using a void pointer. [B]void[/B] … | |
Re: Someone told you that file operations are best for a multilingual dictionary application? Unless you phrased your question incorrectly, then you really should not listen to those people. It sounds to me like what you need is to learn about databases and how to work with them. In the year … | |
Re: [B]> n of crse u ppl are grt..!! [/B] Just letting you know that I think your keyboard might need to be replaced. | |
Re: String comparisons in C using the standard library functions can't directly be used in a switch, and you are basically doing the most efficient way from the perspective of the CPU, which is why as a C program its [B]always[/B] best to avoid using strings if you can use enumerators … | |
Re: [B]> that is the same result if i change the void main into int main(void);[/B] So not to let this point go unchecked, [B]void[/B] should never be used as the return of a C program's [B]main[/B] function. If you are learning C, and your intention is good programming techniques, don't … | |
Re: [B]fscanf[/B] is a perfectly fine function to use for a configuration file with an absolute fixed format. I use it all the time. Wonderful function. Here is an example which could be very relevant to you. This assumes linux. In windows, use the CR/LF combination. This is the data structure. … | |
Re: I'm a little confused with exactly what this is. Why is almost everything returning 2? Is this a copy/paste from an assignment? Are you expecting us to do the work for you? This isn't a "specific" question. | |
Re: [B]>> i need to import one file whic is of .hex extension[/B] file.hex <- one file [B]>> so i need to import a file which should be exactly same name with .hex extension[/B] folder1 / file.hex folder2 / file.hex <- Exactly the same name [B]>> how should i implement such … | |
Re: I don't like the idea that you are assuming that the user will always enter a capital letter. Why are you not using this? [code] #include <stdio.h> #include <ctype.h> [/code] [code] ch1 = tolower(ch); [/code] Its safer in that it checks weather the user typed upper-case or not. | |
Re: I believe the concept of a linked list is that there are many sub lists inside one big list, with each element of the lists randomly scattered within the array, yet linked by pointers to the next element somewhere in the chaos of scattered elements in an effort for some … | |
Re: [b]> i don't really want to live in a nice house for a country that i don't care. my goal is to take over a small island, anyone thinking the same thing? but of course, a nice house is a back-up plan, always need one of those [/b] Usually when … | |
Re: This is more information on [b]initgraph()[/b] which changes the screen resolution: [url]http://www.cs.colorado.edu/~main/bgi/doc/initgraph.html[/url] But obviously it doesn't support 24 bit color. If you wanted to force [b]initgraph()[/b] to use 24 bit color, you'd have to create your own screen mode driver, which in Turbo C might prove to be very difficult. … | |
Re: 8-bit assembly is extremely fun. C is also really fun also. C++ isn't as fun (just structuring your objects and letting the compiler do almost everything). Back in the day I played around with HyperScript for Macintosh. That was fun too, even though it was extremely limited. I guess the … | |
Re: [b]Person person = *p1;[/b] This is copying the pointer address to the first 4 bytes of [b]firstName[/b] in the newly created instance of [b]Person[/b], and then completely undone by line 27: [b]strcpy(person.firstName, "Modified1");[/b] Which overwrites the 4 bytes written by the previous line of code with the given string constant. … | |
Re: With all due respect [COLOR="Red"]Ancient Dragon[/COLOR], the [b]best[/b] solution to his problem is not ODBC. ODBC adds additional layers of overhead and configuration complexity to the more obvious solution of linking to the MySQL C library which exposes nearly all the same commands he used in his PHP code. Here … | |
Re: I will just add that if this is a new project, using an XML configuration file format or using the registry could be better solution than using INI files to store software settings. |
The End.