1,088 Posted Topics
Re: Copy and paste anything that you have saved in C as yours, usually in C:\Document and Settings\<UserNameHere>, to F:\>. You can transfer My Documents to F:\ But you can not transfer anything belonging to the operating system or applications installed already. You can un-install programs and install it again in … | |
Re: You forgot to tell us how soon do you need it? [URL="http://www.daniweb.com/forums/announcement8-2.html"]Click me.[/URL] | |
Re: Welcome over here, yeboah. [QUOTE=yeboah;666477][...]please l want to get control of my computer[/QUOTE] Then, push the turn off power bottom in you computer. Just kidding. Again, welcome. | |
Re: Your program says I can pick from between 1 and 100. What would happen if I pick 6 or 12 or any thing below 50? Probably I'll get old clicking that darn n (no) key. Next time use [URL="http://www.daniweb.com/forums/thread93280.html"]proper tagging[/URL] to post your code. [edit:] You have a problem here … | |
Re: Oh, dear, dear. Where's your effort on the matter? No posted code showing what you have tried already towards the assignment; no help you'll receive, I am afraid. It is not my rule, it is [URL="http://www.daniweb.com/forums/announcement118-2.html"]the policy[/URL] of this board. | |
Re: [ICODE]fflush(stdin); //fflush statements are used thoroughly through[/ICODE] [URL="http://www.gidnetwork.com/b-57.html"]Should not be used at all.[/URL] [CODE]scanf("%c", &key); //the loop and for the "exit" function[/CODE] scanf() has many [URL="http://www.gidnetwork.com/b-60.html"]"gotchas"[/URL] that will throw your logic for [URL="http://www.gidnetwork.com/b-63.html"]a spin[/URL]. You can start reading some of these series. [URL="http://www.daniweb.com/code/snippet266.html"]Read an Ingeter from user.[/URL] [URL="http://www.daniweb.com/code/snippet357.html"]Read a Float-point … | |
Re: [QUOTE=kvvaibhav;665143]How do we pass float/integer arguement to a C program from the commandline, if argv is a character array ??[/QUOTE] You take that string and convert it to a particular value using some of the Standard C functions like strtol for long integer or strtod for double, etc... and then … | |
Re: [CODE]char *replace(char string[COLOR="Red"][100][/COLOR])[/CODE] And now something extra. You don't need to care how long the string passed as an argument is. You can write it like [ICODE]char *replace ( char string[] )[/ICODE] or even like [ICODE]char *replace( char *string ).[/ICODE] | |
Re: [QUOTE]Error E2379 keelan.c 15: Statement missing ; in function main Error E2379 keelan.c 17: Statement missing ; in function main Error E2379 keelan.c 19: Statement missing ; in function main Error E2379 keelan.c 21: Statement missing ; in function main[/QUOTE] [CODE]if(operator == '+') sum = number1 [COLOR="Red"]'+'[/COLOR] number2; else if(operator … | |
Re: [QUOTE=VernonDozier;662164][...] What else is this database used for besides conducting 6 degrees of separation studies?[/QUOTE] Main purpose is to learn how to better tailor targeted ads to you and yours. Now the possibilities for other uses are limitless, or I should say; limited only by their imagination. I leave to … | |
I like to read the signature of my fellow Daniloggers. Some are funny, some are inspiring, some just make me think... what in the world? It is in the thinking part that I engaged when I read this morning the signature of one of our elderst posters. In [URL="http://www.daniweb.com/forums/member.php?find=lastposter&t=129399"]Ancient Dragon[/URL] … | |
Re: Name putw() to something different like putword(). Most likely there's an implementation of putw() already prototyped in your compiler library. Please, make sure you use proper tags when you post code next time. [URL="http://www.daniweb.com/forums/thread93280.html"]Here's how.[/URL] | |
Re: Exactly, where are you having problems with? Be more specific and post relevant portion of code you have tried already and it is not working. | |
Re: [ICODE]hex_test = (char*) malloc (sizeof(char));[/ICODE] [URL="http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1047673478&id=1043284351"]Don't need to cast malloc in C[/URL], in fact no need to allocate memory for just one byte character. If all that you need is a char declare a char. [ICODE]while(!feof(fp_readBin)) [/ICODE] feof should never be used as a control statement. [URL="http://www.gidnetwork.com/b-58.html"]It doesn't work correctly.[/URL] … | |
Re: >I cant find anything wrong with my program, any suggestions? Then, it would appears that most of the necessary steps to correct your program would be over your head. This is not a reason for discouragement, it just says that you need to learn some more. Starting with switch, [URL="http://www.cprogramming.com/tutorial/c/lesson5.html"]read … | |
Re: Some reading examples[URL="http://en.wikipedia.org/wiki/Header_file"] here[/URL], [URL="http://gcc.gnu.org/onlinedocs/gcc-4.3.0//cpp/Header-Files.html"]here[/URL] and [URL="http://www.nongnu.org/c-prog-book/online/x307.html"]here[/URL]. | |
Re: [QUOTE=shankhs;658728]Pretty harsh reply by AncientDragon [...][/QUOTE] Harsh? That is not being harsh. That's practicing at being a jerk without style and heavy on the unoriginal side of the trend. After all, it wasn't very long ago that they used to write “RTFM”. And no; the F doesn't stand for Read … ![]() | |
Re: [iCODE]sscanf(line,"%[COLOR="Red"]3[/COLOR]f[COLOR="Red"]2[/COLOR]", &limit);[/iCODE] remove red part [iCODE]scanf("%[COLOR="Red"]3[/COLOR]d[COLOR="Red"]2[/COLOR]", &x);[/iCODE] do same here. [iCODE]printf("[COLOR="Red"]%3f2\n[/COLOR]", a[n]);[/iCODE] substitute for [COLOR="Green"]%.2f\n[/COLOR] | |
Re: You are loosing precision. For percentages you need to use floating points. | |
Re: [QUOTE=Prabakar;656893] 2) malloc returns a void pointer which needs to be type-casted. [/QUOTE] In C programming, casting malloc it is asking for problems. Include the header file stdlib.h to avoid compiler warnings. Read more about it [URL="http://cboard.cprogramming.com/showthread.php?t=25799"]here[/URL]. | |
Re: In main: [CODE]int result; result = GCD( n1, n2); printf("result = %d\n", result);[/CODE] | |
Re: [QUOTE=Adak;651069]This isn't the place for "can you tell me about some feature of C".[/QUOTE] Since when? [QUOTE=Adak;651069] [...] and we don't have the time to be unpaid tutors. [/QUOTE] Speak for yourself, I would say. I do not restrict information of the knowledge I have been given by others. I … | |
Re: Perhaps? [code] index_s1 = strlen(num_s1) [COLOR="Red"]-1[/COLOR]; /* needed for offset of subscript zero */ /* remove the = part of <= */ for (index_s2 = 0; index_s2 <[COLOR="Red"]= [/COLOR]strlen(num_s1); index_s2++){ num_s2[index_s2] = num_s1[index_s1]; index_s1--; } /* don't forget the '\0' terminator */ [COLOR="Red"]num_s2[index_s2] = '\0';[/COLOR] } [/code] | |
Re: Take a look at the function [URL="http://www.cplusplus.com/reference/clibrary/cstdio/sprintf.html"]sprintf()[/URL] | |
Re: [CODE]void render(void) { int loop; #pragma omp parallel shared(loop) { #pragma omp for for (loop = 0; loop < 100; loop++) { printf("DIE\n"); _flushlbf (); glVertex2f(loop/50.0,loop/50.0); } } glEnd(); glFlush(); } [/CODE] Invoking glVertex outside of a glBegin/glEnd pair results in undefined behavior. [B][Edit:][/B] Some samples perhaps: [URL="http://www.thepcspy.com/read/opengl__shapes_and_colour"]Click here[/URL] | |
Re: >Well it technically still works, Serious trouble ahead if you really think so. [ICODE]char* pStrings[10];[/ICODE] There are 10 pointers to char there, but none has been initialized to a chunk of memory. First is necessary to set aside some memory for each pointer to point to, using the function malloc. … | |
Re: Regardless of any other logic flaws, I would like to point to some of them. [CODE]void process_input(FEELING *ex_1) { char line[200]; char *pstr; int count=0; fgets(line,[COLOR="Red"]201[/COLOR],stdin); /* line can only hold a buffer of 200, there's opportunity for overflow because of that 201 */ ex_1->num = -1; pstr = strtok(line," … | |
Re: [QUOTE=trowa0830;648302]thanks sir.. but now i need another help i want a prgram that continuosly adds the number input then displays the sum when 0 is pressed. all i have is this old code for adding the sum.[/QUOTE] Perhaps you are beyond help. [URL="http://www.daniweb.com/forums/post644509-2.html"]You have been shown some good professional programming … | |
Re: [QUOTE=Adak;647448]Line 571 has this code: [code=C] printf("Edit this record?(Y/N)"); scanf("%s", answer); if(strcmp(answer, "Y")==0) [/code] Which I believe should be changed to: [code=C] scanf("%c", &answer); //answer is a char, not a string if(answer == 'Y') //note the change to a single quote for a char, instead of double quotes etc. [/code] … | |
Re: [quote=shriagni;353288]dear Ancient Dragon ,[/quote] You want to make Ancient Dragon happy?. Learn [URL="http://www.daniweb.com/techtalkforums/announcement8-3.html"]here[/URL] how to properly tag the code you post. [quote=shriagni;353288] i think this is code as u explained to me so i tried out the code not sure which to print out so printed out all the results. … | |
Re: I keep programming to start programming some day. | |
Re: [QUOTE=sambafriends;623259]Thank u very much for this, Why we are putting getchar() again If it is not what happening there please give me reason[/QUOTE] My guess: getchar() only reads one character at a time from the standard input buffer ( stdin ). However by virtue of the nature of the buffer … | |
Re: >How to I get the loop to repeat and not accept a character so I can prevent the infinite loop? By ditching the use of scanf() to read input form user. Here's the start of [URL="http://www.daniweb.com/code/snippet357.html"]alternatives[/URL] on how to read a floating point from user. | |
Re: [QUOTE=Panache;629420]I recently had a computer which suddenly lost support for its CD drives. The original was an IDE drive and so i tried a SATA and even an external USB cd drive. None would be recognized by the pc. It would say "found new hardware" but never given a drive … | |
Re: How's t and t2 declared? [ICODE]FILE *fp=fopen("element.txt","rw+");[/ICODE] How about checking that the file was opened? [CODE]if ( fp == NULL ) { <error...> }[/CODE] Upon success fread() returns the amount of elements read in a form of size_t object; why don't you check that? [CODE]size_t result = 0; result = … | |
Re: [URL="http://www.winprog.org/tutorial/menus.html"]A tutorial[/URL] | |
Re: [CODE]int * readArray(int size){ int *A = malloc ( size * sizeof *A ); int i; for (i=0;i<size;i++){ printf("\nEnter the element no. %d: ",i+1); scanf("%d",(A+i)); } // [COLOR="Red"]free(A); [/COLOR]this when uncommented cause the first element to be zero, makes sense, but // why other values are not lost [COLOR="Red"]return A;[/COLOR] … | |
Re: >And about C hat and C++ hat, I'll Google and see what they are. Don't waste your time doing that. What Salem was trying to convey was that people has the tendency to write C/C++ implying that it is, somehow just a programming language. When indeed C is not C++, … | |
Re: '\n' is not the same than "\n", the first is a newline char the second is a string that contains '\n' and '\0'. Same with any other [URL="http://www.wilsonmar.com/1eschars.htm"]escape characters [/URL]you mention. [ICODE][COLOR="Red"]Printf([/COLOR]"\naa\b\n")[/ICODE] is not the same than [ICODE]printf( "\naa\b\n" );[/ICODE] [ICODE][COLOR="Red"]Printf[/COLOR]("\naa\bc") [/ICODE] '\n' can be used any where inside a … | |
Re: [QUOTE=Salem;626102]So what's YOUR question? Mine is "Why haven't you read the intro posts on how to use code tags?"[/QUOTE] Tricky question Salem; hard to answer. Could you make it a multiple choice one? [QUOTE] [B]a)[/B] Because I am too busy to read any rule and beside, they are not that … | |
Re: Missing [COLOR="Red"]"[/COLOR] before $exit until [ "$answer" = [COLOR="Red"]"[/COLOR]$exit"] ; do . . . esac [COLOR="Red"]done[/COLOR] | |
Re: [QUOTE=jephthah;624672]"FLOAT CODE" is meaningless. [/QUOTE] You wouldn't think the same if some of your code made you `sink down' to the bottom of the pit of desperation. ;) | |
Re: #include "name.h" the compiler looks first in the current directory. #include <name.h> the compiler looks in the default path where the libraries for it are installed. When the programmer do not want to mix header files own made with the standards that came with the compiler, usually it sets them … | |
Re: [ICODE]opt_httphost = argv[0] + 7; //+ 7 removes http://[/ICODE] Nope, argv[[COLOR="Red"]0[/COLOR]] is a pointer to the beginning of the string that hold the name of the program being execute. Given [ICODE]char *opt_httphost;[/ICODE]: [ICODE]opt_httphost = argv[[COLOR="Green"]1[/COLOR]] + 7;[/ICODE] might put you at the beginning of the name address as long as … | |
Re: [QUOTE=dobado;619330]i didnt really get what u r saying but what i need is to write a c prog that return the number of solution for a given n[/QUOTE] Yeah, he has a heavy English grammar, very hard to understand, specially for people like you that try to be up to … | |
Re: [ICODE]if ( fscanf(fin, "%[COLOR="Red"]l[/COLOR]f %d", &fnum, &inum) == 2 ) {[/ICODE] If you are reading into a double you need to let fscanf know by appending a l ( that's the letter `L' ) between % and f [ICODE]if ((fptr = fopen(filename, [COLOR="Red"]"wb+"[/COLOR])) == NULL)[/ICODE] That will erase any data … | |
Re: [QUOTE=somename;618096] [CODE]char time; // or int time; time = [COLOR="Red"]"10"[/COLOR]; sleep(time);[/CODE] [/QUOTE] This is the prototype of sleep: [ICODE]unsigned sleep(unsigned seconds);[/ICODE] Meaning it accepts an unsigned type argument and returns an unsigned type [iCODE]int time = 10;[/iCODE] will work correctly as long as time is an unsigned integer. [ICODE]time = … | |
I am aware that RMDIR /S /Q will delete any directory in a quiet way even if it has content. However, it does not allow the use of wild char for the removal in batch mode. How can I accomplish the task of deleting several directories at once at the … | |
Re: [iCODE]fprintf(pFile,"%d ",State[STATE_SONAR_0+i]/255);[/iCODE] That would be the syntactically correct way of do it. However if the result of the division is a decimal number an int ("%d") will loose precision. Moreover you are not checking the return of fprintf to ensure that it did the job. A negative number would indicate … |
The End.