636 Posted Topics

Member Avatar for Dewey1040

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 …

Member Avatar for jonsca
0
119
Member Avatar for DarthPJB

[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 …

Member Avatar for DarthPJB
0
109
Member Avatar for johndoe444

[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 …

Member Avatar for nezachem
0
254
Member Avatar for Hathake

[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.

Member Avatar for Lerner
0
83
Member Avatar for prokek

[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 …

Member Avatar for prokek
0
103
Member Avatar for darkunknown

[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.

Member Avatar for darkunknown
0
153
Member Avatar for redroze

> [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. …

Member Avatar for uskok
0
153
Member Avatar for onesreality

[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 …

Member Avatar for nezachem
0
734
Member Avatar for MrHooper

[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> …

Member Avatar for MrHooper
0
154
Member Avatar for Dewey1040

[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 …

Member Avatar for nezachem
0
237
Member Avatar for happymadman

> [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.

Member Avatar for happymadman
0
119
Member Avatar for rajeshwari_ib

[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]

Member Avatar for nezachem
0
100
Member Avatar for javaStud

[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.

Member Avatar for javaStud
0
92
Member Avatar for rt.arti

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 …

Member Avatar for nezachem
0
100
Member Avatar for takarii

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.

Member Avatar for takarii
0
121
Member Avatar for Iam3R

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 …

Member Avatar for Iam3R
0
122
Member Avatar for kako13

[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]);

Member Avatar for necrolin
0
142
Member Avatar for mcap61

[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 …

Member Avatar for programmersbook
0
389
Member Avatar for cwarn23

Take a look at [URL="http://www.imagemagick.org/script/index.php"]ImageMagic[/URL]

Member Avatar for cwarn23
0
103
Member Avatar for Nikhar

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.

Member Avatar for nezachem
0
132
Member Avatar for sanitizer
Member Avatar for stewie griffin
Member Avatar for atohas

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 …

Member Avatar for atohas
0
65
Member Avatar for samweb$

[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 …

Member Avatar for samweb$
0
117
Member Avatar for Stefano Mtangoo

Start with [URL="http://msdn.microsoft.com/en-us/library/dd370802(VS.85).aspx"]Core Audio API[/URL]

Member Avatar for Stefano Mtangoo
0
91
Member Avatar for coolfriends

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 …

Member Avatar for ssharish2005
0
120
Member Avatar for tkud
Member Avatar for johndoe444

[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 …

Member Avatar for johndoe444
0
105
Member Avatar for tzushky

[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, …

Member Avatar for tzushky
0
496
Member Avatar for SoulMazer

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] …

Member Avatar for SoulMazer
0
144
Member Avatar for Happypants

[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); …

Member Avatar for Happypants
0
174
Member Avatar for Mattpd

[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 …

Member Avatar for Trad
0
206
Member Avatar for K!nKy

[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 …

Member Avatar for K!nKy
0
968
Member Avatar for simpatar

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 …

Member Avatar for simpatar
0
74
Member Avatar for DimaYasny

[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 …

Member Avatar for DimaYasny
1
296
Member Avatar for shakunni
Member Avatar for Ancient Dragon
0
107

The End.