636 Posted Topics
Re: newMember->person is a pointer. You cannot apply a dot to it. Dot is only applicable to instances. Replace a dot with an arrow in all offending lines, as in [icode]newPerson->fullname[/icode] That was purely syntactical. The last error (which I believe refers to line 42 in the posted code) needs more … | |
Re: [QUOTE=DarthPJB;1082550] C++ standard questions: ------------------------------------------------------------------------------------ The C standard states that the maximum bit's in a char is 8[/QUOTE] It does not. [QUOTE], C++ inherits. I believe the standard also states the minimum bits in a char is 8, is this correct? Am I correct in assuming a char will this … | |
Re: [QUOTE=johndoe444;1082013]I have this code. I want to update the writes immediately to log file before closing the file (because my program might get hang and I have to exit it by ctrl+c so fclose would never be called). The code is: ... but even though I force it to halt … | |
Re: [QUOTE=Lerner;1081915] Third, except for line #1 your code is written in classic C style, not C++ so posting to the C board may get you more responses.[/QUOTE] Not so. pop() argument is passed by reference, which addresses your seventh bullet. [QUOTE]printf([COLOR="Red"]"[/COLOR]%s[COLOR="Red"]"[/COLOR], cast);[/QUOTE] Just to avoid a possible confusion. | |
Re: [QUOTE=prokek;1081001]Hi, I'm trying to write a console program that will sort and find the median of numbers that are given in a text file. The text file can have ints or doubles. The problem I'm having is outputting the median and the insertionSort functions. I think that they are failing … | |
Re: [QUOTE][CODE]srand(time(0)); int main() { Walk(fAverageMoves, iTotalMoves, iTotalHome, fAverageHome, N, x, iTotalPub, fProbHome); return 0; }[/CODE][/QUOTE] You are trying to call functions outside of any function. Put [icode]srand(time(0));[/icode] inside main. | |
Re: > [B]I can't explain the exact difference actually in writing to satisfy you.[/B] The difference is right here: > [icode]answer *= n;[/icode] If you look closely at your first example you will see that there's no assignments, not a single one. An assignment changes what is technically called a state. … | |
Re: [QUOTE=gerard4143;1079962]This should really be posted in the assembly section.[/QUOTE] I don't think so. There's enough problems with C in this code. See comments inline. [QUOTE=onesreality;1079543] I am stuck when i try to display the time on the Lcd panel. It can't seems to show any numbers and update itself. It … | |
Re: [QUOTE=MrHooper;1067415]Hello, If I run the mkdir part by itself it works fine. I just cant seem to get the file to copy into this newly created directory. This is what I have tried: (The words in brackets are the tokens for dir path and filename.) [CODE]mkdir /Volumes/Jobs-2008/Incoming_JOBS/`date +%Y-%m-%d-%H-%M` cp <FILE> … | |
Re: [QUOTE=Dewey1040;1079771]this is the error i'm getting. g++ main.cpp g++ universityperson.cpp[/QUOTE] When you invoke g++ with no options, it will try to make an executable. What you need is an object file. In all your %.o rules (that is, everywhere except UniversityPerson) change [ICODE]g++[/ICODE] to [ICODE]g++ -c[/ICODE]. A -c option stands … | |
Re: > [B]How would I fill a two-dimensional array up with numbers[/B] Exactly the way you do it. > [B]But when I try to print it out it comes up with wierd numbers I printed with:[/B] If you give us more context, we might spot a problem. | |
Re: [QUOTE=rajeshwari_ib;1078188]I have MS word file containing text data[/QUOTE] Then start [URL="http://msdn.microsoft.com/en-us/library/bb656295.aspx"]here[/URL] | |
Re: [QUOTE=javaStud;1077521]The file contains [B]binary[/B] [CODE] if((cfPtr = fopen("Error Pattern 2.dat","r") ) == NULL) fscanf(cfPtr,"%d", &Array[j]); [/CODE][/QUOTE] Binary file needs to be opened in binary mode ("rb"), and may not be read with fscanf(). Use fread() instead. Beware the portability issues. | |
Re: Frankly, I did not get what you are trying to do, but maybe that's just me. [QUOTE=rt.arti;1073033]Hello, The above code gives me values for only one text file and then goes in to an infinite loop. The other text files are generated though as empty files. [/QUOTE] Once you completed … | |
Re: Can you elaborate on the need of > direction = (randint(1,5)+randint(1,5)+randint(1,5)+randint(1,5))/4 Hint: this will give you neither better random, nor a uniform distribution. | |
Re: OK. One step at a time. [QUOTE][CODE] char *ptr = "String"; char arr[]= "Array"; *ptr ='T'; // behaviour is undefined[/CODE][/QUOTE] ptr points to a string literal, which resides in a read-only section of your data. An attempt to modify it results in segfault, GPF or something else depending of the … | |
Re: [QUOTE=kako13;1074337]Hi, I'm reading a line from a text_file.txt The line looks like: 1#Jonh#Smith#PO Box#4.9#5.0#[/QUOTE] What did you see in Cli_nombre? [QUOTE=Clinton Portis;1074356] getline() will return a single line from your file. [/QUOTE] Up to delimiter. He is calling getline(file, ..., [B]'#'[/B]); | |
Re: [QUOTE=mcap61;1075244] My problem is in my void check_name() function... the function that checks if the name is in the list and then displays it as well. When the program runs for some reason it only works for the first set of names (the #1 boy and girl) but in an … | |
Re: Take a look at [URL="http://www.imagemagick.org/script/index.php"]ImageMagic[/URL] | |
Re: They look like exercises on a topic of dynamic programming. [URL="http://en.wikipedia.org/wiki/Dynamic_programming"]This[/URL] can be a good start. | |
Re: > from the command line Can you show the command line? | |
| |
Re: First of all, next time please use a code tag. Second, in such situations it is highly recommended to use a debugger. Third, let's see what happens if the very first answer is -1: size becomes 2, head->item becomes -1, head->next is not NULL. How many iterations will the printing … | |
Re: [QUOTE=samweb$;1070991]I have the following code which works on the .txt file ... Can anyone please help me how can i avoid the memory leaks here[/QUOTE] Frankly, I don't see how it may be freed at all. Judging from the code, you build a list of chunks, and besides that each … | |
Re: Start with [URL="http://msdn.microsoft.com/en-us/library/dd370802(VS.85).aspx"]Core Audio API[/URL] | |
Re: Pay attention to lines 48 and 49. At line 48 you print (i, j, k) as soon as they sum up to x, regardless of their relative primarity. Then at line 49 you test their primarity - and do nothing with the result. You should print data only if the … | |
Re: [QUOTE=johndoe444;1070887] I don't understand why every time, the list_insert method is entered and new linked_list node is created the address of the node is shown to be the same. I need some help please. Thanks.[/QUOTE] A simple answer is that the [I]node[/I] you created is destroyed each time you exit … | |
Re: [QUOTE=Ancient Dragon;1062679]Where did you get that crappy code from??? Toss it out and forget it.[/QUOTE] With all due respect, you are wrong. The code is quite ugly yet perfectly valid. [QUOTE] >> myend = &MyArray[MAX_SIZE]; Wrong -- myend is set to point one element beyond the end of the array, … | |
Re: There are three things in your code which require attention. First, buttonstatus is lost as soon as VariableDialog.apply returns. To keep this value, simply return it: [CODE] def apply(self): buttonstatus = self.status.get() return buttonstatus[/CODE] Then, to get the value you are interested in, call the apply method: [ICODE]status = [I]something[/I].apply()[/ICODE] … | |
Re: [QUOTE=Happypants;1069593]Heya folks. I'm trying to write a BMI calculator, but I'm missing something. Splint tells me I have a parse error before the scanf, but I'm not seeing it. [code=c]#include <stdio.h> int main() { float height, weight; printf("Enter your height in inches and weight in pounds: \n"); scanf("%f%f", &height, &weight); … | |
Re: [QUOTE=Mattpd;1066565]I can print all the files and directories like this [CODE] #include <stddef.h> #include <stdio.h> #include <sys/types.h> #include <dirent.h> int main (void) { DIR *dp; struct dirent *ep; dp = opendir ("."); if (dp != NULL) { while (ep = readdir (dp)) printf("%s\n", ep->d_name); closedir (dp); } else perror ("Couldn't … | |
Re: [QUOTE=K!nKy;1067598]Hey everyone, so I am having a really annoying problem with my code. The goal of it is to be able to read a text file of an unknown length (it's more or less a class roster w/ scores) and calculate and display the average of each student. The code … | |
Re: You must realize that in C strings are not first class citizens. There's no support for them in the language. There's no operator to compare them. There's strictly speaking no such thing as a string. What is there is a memory region occupied by bytes, and a pointer to that … | |
Re: [QUOTE=DimaYasny;1056886]Thanks, but the article uses execve, which is not an option for me in this case. I was just looking for an explanation for line 46, 52 and 54 in my code[/QUOTE] First of all, what difference does this little 'e' make? Second, it is not a C question, but … | |
Re: Use chdir. stat also works, although it may lead to race condition. |
The End.