78 Posted Topics
Re: [QUOTE=3435;1725525][B]Hello everyone!![/B] I am new to Linux forum and have a question related to typecasting in C related to offset of structures. <snip>[/QUOTE] Typecasting is something that happens to actors... | |
Re: Have you noticed that n is only ever zero at the beginning of the program? I'm not 100% sure I understand the purpose of it, but I think you should at least reset it on each iteration of the while loop. Furthermore, what happens when tmp ends up pointing to … | |
Re: Careful of file extensions, too. Windows will mess you up sometimes... if you save something with the extension, make sure it saves as values.txt and not (say) values.txt.java (this shouldn't happen with any IDE I'm familiar with, but you never did say how you created the file). | |
Re: Homework detected, even though you haven't asked a question yet. If this were real code, I'd say go ahead and use goto. The reasons to avoid doing so don't really apply in this particular situation, and it saves time, space and clutter. | |
Re: What kind of image? PNG? Bitmap? Some other format? | |
Re: I don't want to solve your homework problems for you, but maybe I can point you in the right direction. Your problem is that findName finds only the first matching line in the file and returns, correct? So you need to make findName somehow return as many lines as are … | |
Re: "Advanced Java" really doesn't mean anything. I'm guessing it's a class, something like my CS2 class, in which you're still going to be dealing with the ins and outs of the Java language. In other words, probably not looking at hibernate, spring or any of that stuff, and really only … | |
Re: Looks like homework. What are the contents of data_list? What do you need to do to each one? | |
Re: I see what your problem is... but the advice I'm going to give is going to be more useful in the long run than telling you straight. [CODE]# after 'use strict' use Data::Dumper; # then in your code, when you want to see the contents of %seqs warn Dumper(\%seqs);[/CODE] Put … | |
Re: [QUOTE=Gribouillis;1722771]@valorien: also read this as an alternative to the shebang line: [url]http://www.daniweb.com/software-development/python/code/241988[/url][/QUOTE] This sounds like a bad idea. Non-portable, and it means all your Python scripts have to end in .py (and if by chance you were to have an actual binary end in .py you wouldn't be able to … | |
Re: Use code tags instead of quote tags to preserve formatting. The code you've posted doesn't describe the structure you've said it does. => is just syntactic sugar for a comma, so $chainStorage->{ACB} is [CODE]{ E => '06', [100, 200, 95] => 'B', '23' => [20, 1000, 5, 30], }[/CODE] Assuming … | |
Re: Can you be a little more explicit about the program requirements? Like, what should the file look like before and after updatefile() is called, in a sample run? The sample code you've written would overwrite anything already in the file, but you called it "update", so... I'm a little puzzled. … | |
Re: const-qualified variables aren't the same as constants. [code]int const i = 5;[/code] 5 is a constant. i is a variable that happens to be const-qualified, which means you can't modify it directly. Constants can never be modified, because at runtime they usually don't exist. const-qualified variables, well, it depends. const … | |
Re: [QUOTE=Paritosh Das;1459746][CODE]#include<conio.h> #include<graphics.h> #include<dos.h> void main() [/CODE][/QUOTE] I'm assuming those three headers provide all the undeclared identifiers in your code. Care to share with us where they come from? main() returns int. | |
Re: [CODE]printf("Enter the weight in pounds> "); scanf("%lf", £s);[/CODE] Two notes here. First, there's no \n, so the implementation isn't obligated to print the prompt before waiting for input; use [icode]fflush(stdout)[/icode] to make sure it works regardless. Second, check the return value of scanf() to make sure your zero is actually … | |
Re: userRequest is local to getCommand, which means its memory disappears when control returns to main(). strtok() doesn't allocate new memory -- it just zero-terminates a token in the source string and returns a pointer to its first character. Therefore all the addresses in the parameters array are invalid when getCommand … | |
Re: [QUOTE=Madmark88;1456013] [CODE]#include"stdio.h" #include"conio.h" #include"math.h" int main(void) { int a,b = 0; int c=0; printf("Please enter a number : "); scanf("%d",&b); for(a=0;a<1000;a++) { c=(a*a*a)-(a*a); if(b==c) { printf("%d",a); } } getch(); } [/CODE][/QUOTE] For starters, get rid of that conio.h and getch() nonsense, and use angle brackets to surround standard header files, … | |
Re: [QUOTE=WaltP;1454293]But [iCODE]ungetc()[/iCODE] is non-standard and therefore not recommended. It will not work in most compilers.[/QUOTE] Standard section 7.19.7.11 (The ungetc function) begs to differ. | |
Re: Try [url=http://tinyurl.com/46mattc]here[/url]. I have plenty of projects of my own to do, thanks very much. | |
Re: I could tell you how I would do it, but it smells like homework and something you should be working out on your own. If you have specific problems, post [B]complete, compilable code[/B] and ask specific questions. | |
Re: float prod() is not a prototype, it's merely a declaration. float prod(int, float) is a prototype. As you have it declared, prod() returns int. You'll need to declare it otherwise in order to use it the way you want to. Also, the usual: <conio.h> is obsolete and nonstandard, main returns … | |
Re: [code] mt = (mytype*)calloc(1, sizeof(mytype));[/code] Better is [code] mt = calloc(1, sizeof *mt);[/code] 1) don't cast the result of malloc() (and friends), because all it does is hide a useful warning; and 2) [icode]sizeof *mt[/icode] is shorter than [icode]sizeof(mytype)[/icode], and you don't have to change it if you later change … | |
Re: There are really two answers to this question: 1) yes and 2) no. Yes, because the cast in this case does no more than make an implicit conversion explicit. It is the same if you do [icode]float x = 12;[/icode] -- you don't need to write [icode]float x = (float)12;[/icode] … | |
Re: [QUOTE=udaykrishnag;1432819]to find the size of image by knowing the height and width....and by knowing the pixel depth...any solutions plz help.....[/QUOTE] What do you mean by "size"? In what units do you intend to measure such a quantity? | |
Re: "i researched about threading but it's too complicated for me" Translation: "I don't feel like doing real work, can somebody pretty please solve my problem for me?" | |
Re: Your first and most obvious error has been mentioned already. Since you haven't said otherwise, I'm assuming you fixed that error, and since you haven't kept complaining, I'm assuming that fixed your problem. If that's the case, could you mark this thread solved? If you're still experiencing difficulties after fixing … | |
Re: [QUOTE=DJSAN10;1427307]If the main() takes 3 arguments i.e. int argc,char * argv[],char *env[] and SINCE C DOES NOT SUPPORT FUNCTION OVERLOADING ,y does the c compiler does not give error for simply void main() //that is no arguments at all OR void main(int argc,char *argv[]) //2 arguments[/QUOTE] There are two things … | |
Re: I'm not seeing any errors... compiles and runs fine, giving meaningful output. It's rather more verbose and less useful than `ls -F`, though. ;) Do you want to change the way the output is printed? I'd prototype main(), give some thought to the 20-character limit, and use fgets for user … | |
Re: Wait... are you trying to get the determinant of a square matrix? | |
Re: [QUOTE=cool_zephyr;1424587]1. open a pointer to a file 2. read the bytes till the end of file using fread() 3. close the pointer[/QUOTE] I can do you one better: 1. Find a forum that discusses C++. 2. Don't append your question to a 4.5 year old thread. 3. Do some research … |
The End.