1,088 Posted Topics
![]() | Re: >What am I missing? How do I get the first number to display? Move [ICODE]#define NUMBERS 7[/ICODE] outside of main so the function print can see it. In print() remove [ICODE]i= *nums++[/ICODE] which is doing harm and producing nothing since you change the value of i inside the loop to … ![]() |
Re: You use the standard C functions [URL="http://www.cplusplus.com/reference/clibrary/cstring/strcat.html"]strcat()[/URL] | |
Re: [ICODE]temp[strlen(temp)-1]='\0';[/ICODE] assumes that there's always a '\n' at the end of line, and that could be not the case. [CODE=C] /* wanted MAX_LEN of data, is there something to read? */ if (fgets(temp, MAX_LEN, input) != NULL) { size_t net_len = strlen(temp) -1; /* trim the newline/return if it's there … | |
Re: [QUOTE=vikas1;765766]the following written attachment can be your answer....[/QUOTE] Make a habit of noticing the date when the post was written, and then make a judgment if your comment is going to be of some value, based on the time passed. | |
Re: Since you don't check the return of fgets() for success, sscanf() is at the mercy of whatever got assigned into the variable [I]stemperature[/I] As a test, include [ICODE]printf("Show me what's in stemperature >>%s<<\n", stemperature);[/ICODE] after [ICODE]fgets(stemperature, 4, pf1);[/ICODE] to show you what I mean. It is always a necessary practice … | |
Re: [QUOTE=Narue;577308]>eek Yea, that's why everyone keeps saying I've mellowed out. ;)[/QUOTE] Silly people, don't they know volcanoes. At anytime they can erupt again. It is in their nature. | |
Re: [QUOTE=Clockowl;764961][...]I disagree with this: "The string is a constant, so calling strlen() every time is only going to waste time, because it always returns the same result." I'm expecting my compiler will do that for me, it seems like a very simple optimization to make, right? The rest is right … | |
Re: About [URL="http://puppylinux.org/wiki/how-tos/general/filetypeassociation"]File Type Association[/URL] in Linux A more [URL="http://groups.google.com/group/alt.os.linux/browse_frm/thread/606cd73e9b8e8815/e81cd868ffc2b50b?lnk=gst&q=file+association+in+linux&utoken=dTQB0C8AAAAiXwthDVv3-0EgBRvjJ00A8OBQgCxQ0ScvHI3DrmakHRGZ_JFPllpHm_8hELQTsBc"]serious conversation[/URL] at alt.os.linux google groups | |
Re: [ICODE]char *glblclrtab;[/ICODE] by itself will not allocate any memory to be use. [B]malloc()[/B] must be invoked to set apart as much memory as needed to hold the data you intend to assigned (point) to it. | |
Re: >creates the file or directory A menu to choose what to create could be an option in this situation. Read here [URL="http://www.tldp.org/LDP/abs/html/testbranch.html"]how to create menu[/URL] Meanwhile if a loop will do you need to think how to exit the loop. Something like... [CODE=bash]until [ "1" = "0" ]; do #forever … | |
Re: The errors come from using the fwrite() function in an incorrect way. Here's an usage [URL="http://www.cplusplus.com/reference/clibrary/cstdio/fwrite.html"]example[/URL] Pay attention to its prototype. | |
Re: [QUOTE=Creator07;762874] Hello, I tried it as you said, but its still not working. [/QUOTE] Show us the code. [QUOTE=Creator07;762874]Incidentally, its taking the value of Designation but no name!!!! and added to that, fgets is also putting 2 '/n' after I complete the input... May be that which I input(by pressing … | |
Re: [quote=joshSCH;393520]Indeed. Rashakil is sure to sweep this thread and give us all bad rep lol.. [/quote] If you keep posting his handler name you surely are going to wear it out. May be he needs to ask you for royalties for using his alias so many times. | |
Re: strtok() will try to find whichever characters you'll pass it as the second parameter. If you give it a '/', it will return a pointer to the first time it encounters that character. Enclose it into a proper designed loop and you can use it to chop the given array … | |
Re: [QUOTE=Pender;755693][...] i need now a command (e.g. awk or sed) which deletes the whole line containing the name, plus next line. but it must be exact match, deleting "test " must not end up in deleting all lines including "test" like "testt" or "testtt" [/QUOTE] [QUOTE=Pender;755710]i have no clue how … | |
![]() | |
Re: [QUOTE=LightSystem;594286]Ive just found out that in line 78: fgets(aluno, 20, stdin); If I replace 20 with 4, I dont get the error I described above when inserting 1000. Why is that??[/QUOTE] Changing the range of characters that fgets can read to four will only put 100 + \0 into the … | |
Re: [ICODE]for(i=10;i<50;i++)[/ICODE] This will display every character starting at seq[10] and will stop at seq[49]. Is the array that you passed as an argument in justapoe() that long? like char seq[50]. Has it been initialized with some value already? Before passing it to the function?, if not, guess what? It contains … | |
Re: You're living in the fast lane. Before you can understand structures and pointers in C you should have learned that main is defined as: [ICODE]int main(void) [/ICODE]or [ICODE]int main(int argc, char *arg[])[/ICODE] and in both cases it needs to return an int. | |
Re: Darn it, I didn't know we were having fun with our favorite cartoon characters over here. Let me participate and contribute this [URL="http://wizbangblog.com/content/2008/09/19/what-happened-when-obamas-teleprompter-broke.php"]piece[/URL] destine to become a classic. | |
Re: [QUOTE=The Dude;709937][url]http://www.doncastertoday.co.uk/ViewArticle2.aspx?SectionID=786&ArticleID=1052313[/url] I dont think its a good idea........ They cant tell whats OK and what isnt most of the time and if they start playing with a TOY GUN,they might think a real gun is the same!![/QUOTE] Should we allow children play with cars? They smash them one against … | |
Re: [QUOTE]Listen mate - you're definitely not British. Or Australian. Or Canadian even. British culture is simply not your cup of tea. And you're obviously off your trolley! If it just so happens that you live or come from Great Britain, you're still not British. There's not really anything British about … | |
Re: [quote=christina>you;398406]Is this girl interested in you?[/quote] No. In his car. You have a car, I presume?. No?!. Fat chance!. | |
Re: [CODE=c]int n = 444; printf("%09d", n);[/CODE] More examples [URL="http://www.daniweb.com/forums/post399355-3.html"]here[/URL]. | |
Re: [ICODE]sed '1 i\ ' [/ICODE] will add an empty line above the first line (that's a [B]one[/B] and not a low [B]L[/B], there's a space between [B]\ [/B]and last [B]'[/B]) [ICODE]sed 's/^$/2/'[/ICODE] will substitute any empty lines for a 2 | |
Re: [QUOTE=Serunson;711789]The previous prime minister was Tony Blair, also an idiot, and the current one is Gordon Brown, a very big idiot. Basically the entire Labour party are out to make our lives a living fortress of DOOM, by taxing us, and making us a nany state, where we cant do … | |
Re: First you need to use a function for reading input, that will not stab you on the back as scanf() does. ;) Take a look at fgets() and how it works. With it you can always limit the amount of input it will read from stdin, and you'll be always … | |
Re: [QUOTE=paulthom12345;726307][...] So maybe squaring the dollar would make it... more valuable? [...] [/QUOTE] I thought that was called "stretching a buck" ;) However, I tried to square it, and now is worth...well, you see. :'( | |
Re: [QUOTE=sneekula;726599]Absolutely fantastic smear! Now I know why most people will vote for Senator Obama.[/QUOTE] You don't know jack. | |
Re: Before [ICODE]average=total/i;[/ICODE] just add [ICODE]printf("Tell me what's in i: %d\n", i);[/ICODE] and perhaps you'll find out the problem. | |
Re: >so i just want learn what i am doing wrong for future reference. The first thing would be compiling a C++ program [ICODE]portfolio2.cpp[/ICODE] C code doesn't end in .cpp, they end in .c | |
Re: >Also, for N, I want to start at 25 and bump it up by 25 through each loop... If I understand correctly. [CODE]for (i = [COLOR="Red"]25[/COLOR] ; i < N ; [COLOR="Red"]i += 25[/COLOR] )[/CODE] You are not returning the final result of sum. | |
Re: That particular one is a simple coma been missing. [ICODE]sscanf (argv[1][COLOR="Red"], [/COLOR]"%d %d %d", &a, &b, &c);[/ICODE] Did you forget to return in main? [Edit:] By the way argv[1] should be replaced by another variable place holder if you intend to ask the user for some input and after you … | |
Re: > i think it would really help u.. No it won't. >i have got the program for the calculator using graphics . Why did you not just paste the [URL="http://www.cetpainfotech.com/c%20projects/calculater.c.txt"]link[/URL] where you got it? The least you could have done it is to use [URL="http://www.daniweb.com/forums/post452439.html#post452439"]proper code tagging[/URL]. | |
Re: >which CODE tags should i use? [URL="http://www.daniweb.com/forums/thread93280.html"]Click here.[/URL] | |
Re: [QUOTE=ddanbe;723446]Test for an end of file condition. Use something like [B]while(!feof(inputfile)) [/B][/QUOTE] Bad idea, feof() shouldn't be use as the exit control of a loop. [URL="http://www.gidnetwork.com/b-58.html"]Read on[/URL]. | |
Re: [QUOTE=yuvaraj.tr;725266]int sec_code; printf("enter the sec_code"); scanf("%d",&sec_code); while(sec_ocde < 0 && sec_code > 4 ) { printf("invalid Sec_code \n please enter between 1 to 4 "); }[/QUOTE] That it is a nonsensical condition. When would that condition meet? Nonetheless, it is a good thing that it doesn't, because it would enter … | |
Re: >I will add comments shortly to explain how this works. You should seriously consider learning how to do it on your own, otherwise, you will not pass your class. How come? When all [s]he needs to do is copy and paste. >This is the correct code. No it is not. … | |
Re: [QUOTE=sneekula;720693]I am not from Scotland, but would love to be! [/QUOTE] Just imagining. | |
That word got stuck in my ears as I forced myself to watch to the end. Why do we even have to question such unspeakable actions against the innocent and defenseless? You tell me what kind of creature are we by standing without doing anything about it. [url]http://www.youtube.com/watch?v=foSW-CkWbqI[/url] To which … | |
Re: Let's work with what you have. [CODE]counter initialized to zero while counter less or equal to nine; do row initialized to zero while row is less or equal to counter; do echo -n row #-n suppress echo from adding a newline increment row by one done echo increment counter by … | |
Re: >the question: [URL="http://www.daniweb.com/forums/announcement118-2.html"]The answer[/URL]. | |
Re: I don't have any intention of debugging your whole code, but... [CODE]lop1 = 0; while (read(fd, &rdr, 1) == 1) { [COLOR="Red"]fstrg[lop1] = rdr;[/COLOR] if (rdr == '\n' || rdr == EOF) break; } [/CODE] fstrg[[COLOR="Red"]lop1[/COLOR]] is always fstrg[[COLOR="Red"]0[/COLOR]] | |
Re: >i am really in trouble with this issue? Yes you are. Definitely, over your head if you can't [URL="http://www.daniweb.com/forums/announcement118-2.html"]read[/URL]. | |
Re: [CODE]typedef struct node { char value; bool isroot; bool isend; struct node* sibling; struct node* child; }[COLOR="Red"];[/COLOR] [/CODE] He meant there. | |
Re: Post your main array definition. Your code should work as expected. | |
Re: Further [URL="http://www.augustcouncil.com/~tgibson/tutorial/ptr.html"]understanding[/URL]. | |
Re: >However, I've realized this does not work because of the way arrays are addressed. Nothing to do with it. Your error is in the subscripts. [CODE]array[2] = array[1]; array[[COLOR="Red"]1[/COLOR]] = array[[COLOR="Red"]0[/COLOR]]; array[[COLOR="Red"]0[/COLOR]] = result;[/CODE] |
The End.