1,088 Posted Topics
Re: daniweb is like a normal mattress, but it can easily be recycled. Let's interpret that in a positive way: [B]daniweb is like a normal mattress[/B]; mattress invite comfort; rest of the labor of the day. [B]but it can easily be recycled[/B]; Heck yes, you just have to press Reload current … | |
Re: [QUOTE=nikita_knp;542733]can anyone plz help me out..to make a text editor in C... i dun even know where to start with... [/QUOTE] Make sure you implement a spell checker. It appears you can make use of it. You need to post your code in order for us to get an idea … | |
Re: [CODE][COLOR="Red"]char path[/COLOR],argum; [COLOR="Green"]/* path needs to be a string or array of chars */[/COLOR] printf ("Enter the path name "); scanf ("%[COLOR="Red"]c[/COLOR]", &path); [COLOR="Green"]/* It's getting only one character it needs to read a string */[/COLOR] [/CODE] | |
Re: A segmentation fault occurs when a program tries to access memory location that is not allow to play with. My guess is that your char* is pointing to some wrong memory location. Maybe you haven't initialized to point to a string. | |
Re: [QUOTE=mayank24;544467] Can anybody tell me what condition I have to use here?[/QUOTE] I see the possibility of an switch inside a do/while loop [CODE]declare an input variable and a flag variable set a flag to false ask the question do obtain the user input switch input variable wrong input: display … | |
Re: [QUOTE=Google Spider;543440]maybe some misunderstanding on your part ?[/QUOTE] Nope, this thread got moved from C++ forum to C | |
Re: [QUOTE=joshSCH;519382]I don't have anything to hide..[/QUOTE] It is that kind of mentality what makes us "sheep" ready for the butchery. I do have things to hide. That's why I wear clothing. What if I want to hide pictures of my family? Bank statements? An important project that I want to … | |
Re: [QUOTE=RexxX;542427] *edit - So do I just need to allocate a memory location to newNode? If so how?[/QUOTE] Using malloc defined in stdlib.h [CODE]*newNode = malloc ( sizeof ( struct node ) );[/CODE] Any dynamic memory you allocate, it needs to be freed at some point, when you're done; using … | |
Re: Go here and download [URL="http://www.mindviewinc.com/ThinkingInC/Beta3Download.php"]Thinking in C[/URL] by Bruce Eckel. These are a sequence of flash tutorials. Lesson 2 is all about data types and their limits. At the end of that lesson there's an exercise example of how to round up a float to the nearest whole. | |
Re: >sort_date(struct_acc Acc[], int n);//Here Is Where the error is?? That should be a function call, however you are making it like if it were a prototype of the function sort_date. | |
Re: It is as futile to measure [B]Life[/B] by the stick of fairness as it is to measure [B]Ligh[/B]t in liters. | |
Re: Glad you found a possible solution. If you're going to stick around could you do us a favor? Could you stop Capitalizing at random some ( most ) of the words? It makes your post hard to read. And we could live without the ..................... as well, it doesn't do … | |
Re: >I'm learning how to use fgetc properly fgetc reads a character from the stream passed and return that character. The catch is that character needs an int, so fchar needs to be of type int. ...but that's not your problem. [CODE]printf("The first char is %s\n", fchar); //print a character[/CODE] print … | |
Re: Very eloquent title for your post. You are looking at the wrong variable. You are paying attention to qevent when you should pay attention at rendering = 1; From here what I see is that when the [B]if (qevent > 0)[/B] gets executed, it sets [B]rendering = 1;[/B] and according … | |
Re: Perhaps a little more practice is required with easier concepts, before attending such modifications? Went through the first function step by step. Look at the logic written in comments. [CODE=c] char nocomment() /* void nocomment() since there's no return by this function */ { FILE *src, *noc; /* two pointers … | |
Re: salary and rate needs to be floats not ints To display only two digits in the decimal section: [CODE]printf( "%.2f\n", salary );[/CODE] | |
Re: You can parse the string looking for spaces using the function [URL="http://www.cplusplus.com/reference/clibrary/cstring/strtok.html"]strtok[/URL]. Or you can do it in [URL="http://www.daniweb.com/code/snippet318.html"]this way[/URL] | |
Re: char *pstr = [COLOR="Red"]finlename[/COLOR]; misspelling of filename scanf("Enter the filename: %s", [COLOR="Red"]&[/COLOR]filename); remove the & at filename printf("The name of the file is %s", [COLOR="Red"]&[/COLOR]pstr); remove the & at pstr [COLOR="Red"]function[/COLOR](pstr); wrong function, it should be called func | |
Re: write getchar(); before return. That should pause until you press enter if no characters was left behind in the stdin. If you can change compiler. Miracle C is broken. Look[URL="http://www.daniweb.com/forums/post234971-1.html"] here [/URL]for some suggestions | |
Re: argv[1] is a string even if you enter a character. Find the length of the string and use a loop to go through each character. [CODE]printf( "%d\n", argv[1][i] );[/CODE] [Edit] That example will display the first character of the string. [B]printf( "%d\n", (int) argv[1] );[/B] is displaying the possible interpretation … | |
Re: [B]Did[/B] you wonder how come Ancient Dragon's code post looks so nice and your post is all scattered over, and hard to read? Please [URL="http://www.daniweb.com/forums/post452439-1.html"]read[/URL]. | |
Re: *cus[max]; This declares 100 pointers of type customer, but you haven't point them to any memory, therefore you cannot use them in the fscanf() call. Malloc can set apart memory of type structure customer and you can access it via cus pointers. | |
Re: [QUOTE=jephthah;533371] now tell me, do you always engage in such tendentious pedantry on trivial matters, or do you reserve this unappealing behavior only for the new people? [/QUOTE] Are you saying you never read the fraternity initiation test post? So far the judges are not impressed. You better be ready … | |
Re: void fileReader(infile[] ); like void fileReader( char *infile ) ??? [B][Edit][/B] That's the prototype of a function that accepts a string as parameter fileReader( string ); is the actual call in main where string could be char string[] or char *ptr_to_string = string; or char *string = "literal string"; | |
Re: If I'd have all the money in the world, money would be called something else. | |
Re: [QUOTE=Duoas;530865] Before complaining too loudly you should have noticed that my algorithm and yours are nearly identical. [/QUOTE] Man, as soon as I saw that sentence of yours with "nearly identical" I thought. Poor guy. He's is leaving himself open for incoming cheap criticism. | |
Re: [QUOTE=wollacott;531124]i havent tried it yet caz i'm stuck here what shud i put after & so it can work? printf( "Enter product number \n"); scanf("%f",&); printf( "Enter quantity : \n" ); scanf("%f",&);[/QUOTE] [CODE]int product; scanf( "%d", &product ); int quantity; scanf( "%d", &quantity ); [/CODE] | |
Re: Stick with one forum. You are been helped over [URL="http://cboard.cprogramming.com/showthread.php?t=98476"]here[/URL]. | |
Re: [QUOTE=LisaLLL;519276]I am trying to edit a string in c. I need to remove the last 84 characters from a string[400], insert text and re-insert the 84 character string at the end. No problem adding text or coping text in C, but I can't remember how to reorder/manipulate the text string. … | |
Re: What part did you not understand of the answer over [URL="http://cboard.cprogramming.com/showthread.php?t=98355"]here[/URL]? | |
Re: A little snippet can be found [URL="http://www.daniweb.com/code/snippet719.html"]here[/URL]. For getting deeper in the bowels of MS Windows check this [URL="http://www.winprog.org/tutorial/start.html"]one[/URL] | |
Re: [CODE]scanf("%s", &name); [/CODE] scanf() is not a good choice to read a string. User fgets() instead. [CODE]FILE *file; file = fopen(name, "r");[/CODE] What happens if the file doesn't exist. Must check that the file can be opened. [B][I]exempli gratiā [/I][/B][CODE]if( file == NULL ) { < handle the error> }[/CODE] … | |
Re: According to MS, [URL="http://msdn2.microsoft.com/en-us/library/ms645505.aspx"]hwnd[/URL] is a Handle to the owner window of the message box to be created. If this parameter is NULL, the message box has no owner window. This thread is getting a little old by now. You'll get better result if you post in a new thread … | |
Re: Go to statements go like this: [CODE=C]/* create the label */ ins: /* then call the goto */ goto ins;[/CODE] Substitute every [COLOR="Red"]goto <label>:[/COLOR] that you have for [COLOR="Green"]<label>:[/COLOR] or goto <label>[COLOR="Green"];[/COLOR] depending on if is a call or a label. [B]BTW.[/B] What a fine example of why [B]goto[/B] shouldn't … | |
Re: If you're creating a program that copies a file you need to look at these standard functions: fopen(), fclose(), fread() and fwrite(). | |
Re: [B][I]I want to be handsome, rich and famous[/I][/B]. Unfortunately, none of the members in Daniweb seems to be able to help me. Still waiting, though. ;) Post the pertaining part of your code concerning to you request. Make a clear inquire about your problem. And perhaps, you'll be helped sooner … | |
Re: We haven't learn how to count down regular natural numbers and you want us to follow this one. Ha!. We'll see. 3 | |
Re: [QUOTE=bobei89;515503]if(!(a%10)) but what is not (a%10)? [/QUOTE] [B]if( !( a % 10 ) )[/B] What's the programmer trying to achieve here? Is looking for when the result of the operation [B]a % 10[/B] would be [B]0[/B], however [B]0 [/B]inside an [B]if[/B] statement will never execute since in [I][B]C[/B][/I], [B]0[/B] is … | |
Re: [QUOTE=stackOverflow;513650]I agree, but its unfortunate that few schools like ours still insist on "riding a horse". And i have no choice but do what i am supposed to ...[/QUOTE] [I][B]"Don't let school get in the way of your education." [/B][/I]~[B][URL="http://en.wikipedia.org/wiki/Mark_Twain"]Samuel Langhorne Clemens[/URL][/B]~ What would prevent you from installing a modern … | |
Re: Concerning this: [CODE]gets (argv);[/CODE] [B]NEVER[/B], ever, ever, [B]EVER [/B]use [COLOR="Red"]gets[/COLOR]. Forget that exist. You did not understand what Ancient Dragon was telling you. argv is an array of pointers to strings, where input could be used at the start of the program in command line. If you want to obtain … | |
Re: [CODE=C]void modifyString(char *pstr) { char *str = pstr; // Make changes to str ... } void doSomething() { char str[] = "Hello World"; modifyString(str); }[/CODE] | |
Re: If all that you want to do is to remove the new line you could always look at the character before the nul terminator. [CODE]if ( words[i][ strlen( words[i] ) - 1] == '\n' ) { words[i][ strlen( words[i] ) - 1] = '\0'; } [/CODE] However since you want … | |
Re: [CODE][COLOR="Red"]char[/COLOR] f; f=getch();[/CODE] getch returns an int. Therefore, f needs to be of type int. | |
Re: [QUOTE=arun_fire;505155]...But it wasn't as bad as you wrote about it. ....i do agree that main is recommended to return int under c99standard.but some systems like tuboc will allow it.[/QUOTE] It is human to err, but is stupid to continue in the err. | |
Re: [QUOTE=bobei89;500699]OMG this is the problem i get while use the functions warning C4013: 'strlen' undefined; assuming extern returning int[/QUOTE] strlen() is defined in the header file string.h. [B]#include <string.h>[/B] | |
Re: [quote=Ene Uran;449472]I assume there are silly names like this for all presidential candidates. [/quote] No. Only to her. | |
Re: I am not quite sure I am understanding what you want in its totality. However it should be in these lines: Use fgets() to obtain pertinent information from user. Do calculation with the information. Store calculation in variable display the value in variable. What's sth? What do you intent to … | |
Re: strcpy() is not like printf() that accepts a format specifier as a parameter. You need to convert the integer into a string before trying to add it to the final buffer. Search for the function sprintf to do that. | |
Re: [QUOTE=jobs;497750] What is the problem here? I am running linux and gcc 4.1.[/QUOTE] You're compiler doesn't know what O_RDONLY is. Did you include fcntl.h? | |
Re: [QUOTE=elite1986;497681]Hi , The source is working but i do not understand how can work in line 68: the function without giving arguments. Thanks for reading.[/QUOTE] [CODE]int (*compare)(char *s1, char *s2); [/CODE] This is a pointer to a function that would have two parameters strings. [CODE]int reverse(char *p1, char *p2); int … |
The End.