6,741 Posted Topics

Member Avatar for lehe

>extern unsigned char jetmap[][]; //missing subscript Yep, you're required to specify all but the first dimension, even for an incomplete type. You need it in the definition too: [code=c] /* .c file */ unsigned char jetmap[][3] = { /* ... */ }; /* .h file */ extern unsigned char jetmap[][3]; …

Member Avatar for lehe
0
118
Member Avatar for starletcharmed

What happens when you test it? What happens when you do a paper run? There won't always be someone sitting around to tell you that your code is correct, so you need to learn how to verify such things through a methodical process.

Member Avatar for cikara21
0
101
Member Avatar for bondo

>char* word; /* Temporary holding for each word */ >fscanf(fin, "%s", word); Pointers aren't magic containers for infinite data. You need to allocate space to word before you can write to it. In this case, there's little point in using a pointer unless you want to get fancy with single …

Member Avatar for bondo
0
173
Member Avatar for lehe

>Is it correct to use the conversion specifier "d" with unsigned char in "fscanf"? Nope. You have no idea how your implementation of fscanf will work. It's especially dangerous to say you'll pass a pointer to a type of one size and actually pass a pointer to a type of …

Member Avatar for lehe
0
208
Member Avatar for Lukezzz

That doesn't sound like a bad thing to do at all. :icon_rolleyes: You might want to start reading The Old New Thing; there are plenty of horror stories about bad programmers who break the rules like that and screw up Windows for years to come.

Member Avatar for Lukezzz
0
189
Member Avatar for Lokolo

>unresolved external symbol "public: int __thiscall Object::returnCustomerID(void)" returnCustomerID is declared in Object (why?), not defined, and it's not virtual. I'm not surprised your linker is complaining that it can't find the definition.

Member Avatar for Lokolo
0
113
Member Avatar for nedsnurb

>// unecessary brackets Which can be used to introduce a new scope without adding a one-off function or doing something dumb like: [code=cplusplus] if ( true ) { // Stuff } [/code] You'd see it more in C prior to C99 where you want to restrict the scope of a …

Member Avatar for nedsnurb
0
133
Member Avatar for king_khan

>Please Solve my some problems. Daniweb isn't a charity service. Don't expect anyone to do your homework for you, slacker.

Member Avatar for Ezzaral
0
72
Member Avatar for nisha_fortune

>snmpd.c:379:17: error: map.h: No such file or directory If you want to use the std::map class, it's in <map>, not <map.h>. All of the modern standard C++ libraries omit the .h extension. >snmpd.c:381: error: syntax error before 'namespace' What brand and version is your compiler?

Member Avatar for Nick Evan
0
156
Member Avatar for sillyboy

>Just wondering why remember me is checked by default. Defaults are usually determined by the expected "usual" behavior of users. I'm sure Dani determined that the majority of users would want to be automatically logged in when returning, so the box is checked by default.

Member Avatar for Nick Evan
0
166
Member Avatar for DefConBandit

>which would be the best for a beginner with no prior programming experience It really doesn't matter. You'll learn how to program regardless of which language you choose, and the only way to figure out if you'll be comfortable for the long haul in learning a language is to start …

Member Avatar for punjabivirsa3
0
183
Member Avatar for brechtjah

>So, number[2] should give me the number I want Nope, it should give you the character that the value returned by function represents. Characters are represented internally by integer values. For example, in ASCII you can expect the letter 'A' to be represented internally by the value 65. If function …

Member Avatar for brechtjah
0
191
Member Avatar for tnvkrishna

>Is it necessary for a compiler to follow ANSI standards To be strictly correct, it's the ISO standard. And yes, ideally your compiler should conform to the most recent standard as much as possible. However, complete conformance isn't necessary as most of the time the parts that aren't implemented are …

Member Avatar for jbennet
0
219
Member Avatar for xlx16

>Pay attention to "but otherwise its type is implementation-defined" >and "or in some other implementation-defined manner" clauses... >Any comments? I always have comments. Let's break it down because you've quoted two separate things. The first quote is a slice of the following sentence from the C++ standard: [quote] It shall …

Member Avatar for ArkM
0
96
Member Avatar for shankhs

>fin.open((char *)&str,ios::in); Eew, use c_str instead: [code=cplusplus] fin.open ( str.c_str(), ios::in ); [/code] You only have to escape a backslash in literals, so the following will work fine: [code=cplusplus] string str="C:\\Documents and Settings\\shankhs\\Desktop\\ccs\\Assignment CCS.txt" [/code] For input, you don't need to worry about escaping a backslash because it's already correct. …

Member Avatar for shankhs
0
145
Member Avatar for afg_91320

>my hw says it has an error in the code I count four errors. Since you mention homework, is this a homework question that [I]you[/I] should be doing instead of trying to get other people to answer?

Member Avatar for Narue
0
174
Member Avatar for hajjo

Please post your code inline or attach it if it's huge (1KB isn't huge, by the way). Not only is it irritating to have to go to third party file sharing services, it's terribly frustrating when the free service is unavailable due to server load. Most people won't bother to …

Member Avatar for Narue
0
105
Member Avatar for BigFormat

>malloc() always returns a void pointer. You need to typecast it. C is kind enough to implicitly convert to and from pointers to void without the need for a cast. In fact, if you get into the habit of casting the result of malloc, your code is both more prone …

Member Avatar for Clockowl
0
3K
Member Avatar for koman

This is how you read a file using getline: [code=cplusplus] while ( getline ( infile, buffer ) ) { // Process the line } [/code]

Member Avatar for VernonDozier
0
150
Member Avatar for skatamatic

find_if returns an iterator to the matched item, and for_each is retarded. ;) [code=cplusplus] CTest *it = b; CTest *end = b + 150; while ( ( it = find_if ( it, end, myCountIf ) ) != end ) { it->Set(); ++it; } [/code]

Member Avatar for skatamatic
0
190
Member Avatar for Marauder

>void trim(string[], int num) This should be: [code=cplusplus] void trim(char string[], int num) [/code]

Member Avatar for Narue
0
107
Member Avatar for elsa87

>please help me write a function which will return the last element in an unsorted list. How appropriately vague. When you say "last element", what do you mean? Do you mean the physical last item or the last sorted item? When you say "list", do you mean an array or …

Member Avatar for Narue
0
143
Member Avatar for anny**
Member Avatar for techgenie

>error C2660: 'Lottery::displayLottery' : function does not take 0 arguments >void displayLottery(int []); Looks like it takes one argument to me. You can't lie to your compiler, it doesn't work. >error C2513: '__time64_t' : no variable declared before '=' >time_t = t; Yep, this error is pretty straightforward too. You …

Member Avatar for skatamatic
0
285
Member Avatar for hightechgirl7

Posting your homework isn't going to get you help. You need to specify what you don't understand, and if you want help with a solution, post what you've already tried so we don't assume you're mooching off of us.

Member Avatar for mabpest
0
291
Member Avatar for atish12

>what should i do for this? Read as much as you can, write as much code as you can, ask questions here, and try to answer them as well. Repeat ad infinitum. Pretty much everything you'd expect to acquire a difficult skill.

Member Avatar for ithelp
0
83
Member Avatar for SteelSlasher

>i was wondering if an xml could parse html You mean can an XML parser handle HTML? Probably not, given the differences between XML and HTML in terms of leniency and syntax. XHTML would be a better choice than HTML, I think.

Member Avatar for Ezzaral
0
230
Member Avatar for ajay.krish123

Put simply, it gives you a pointer to the starting address of text mode video memory. Since the address doesn't change, you can cast it to a pointer to char and assign to offsets from that pointer to write to the appropriate memory blocks.

Member Avatar for gagansharma
0
184
Member Avatar for Gannon56789

>Here is my constructor. Is that the whole of your constructor? If so, it's not accomplishing much of anything as you allocate memory to the local variable EmpPointer, and then proceed to leak memory when EmpPointer goes out of scope at the end of the constructor.

Member Avatar for Agni
0
212
Member Avatar for nedsnurb

>error C2106: '=' : left operand must be l-value In your code you say [ICODE]if ( n % i = 0 ){[/ICODE]. C++ uses == for equality and = for assignment, so you're using the wrong operator. >error C2065: 'i' : undeclared identifier This is a simple one: you haven't …

Member Avatar for MosaicFuneral
0
179
Member Avatar for tones1986

>when i attempt to swap etc, it doesnt work and i get a crash Step through your code and see what the indices are just before you crash. By the look of things, you're trying to use a negative index, which suggests your math is off. Keep in mind that …

Member Avatar for tones1986
0
141
Member Avatar for revini

>I need to create an array of strings using a set of string pointers. Why don't you describe what you're doing rather than how you want to do it. Perhaps there's a better way.

Member Avatar for revini
0
112
Member Avatar for bondo
Member Avatar for hellIon

>i am using miracle c compiler Miracle C is a [I][B]horrible[/B][/I] compiler. Trash it and get anything else, or you'll have to suffer through constant battles of perfectly valid code failing to compile or not working correctly. Try [URL="http://www.codeblocks.org/"]Code::Blocks[/URL], [URL="http://www.turboexplorer.com/cpp"]Turbo C++[/URL], or [URL="http://www.microsoft.com/express/vc/"]Visual C++[/URL].

Member Avatar for Narue
0
135
Member Avatar for ting_ting

[QUOTE=ajay.krish123;734153]abov e program can also be written as: [CODE] void main() { ------ ----- getch(); }[/CODE][/QUOTE] Yes, it can be...if you want your code to be subtly broken and non-portable. The main function returns int by definition. getch isn't a standard function, so you'd be relying on a library extension …

Member Avatar for Narue
0
137
Member Avatar for SphinCorp

Well, what's the type of page_directory[0]? page_directory is a pointer to unsigned long, right? So after an offset and dereference you'd be looking at an unsigned long, thus: [code=c] page_directory[0] = (unsigned long)page_table; [/code] That will make your error go away.

Member Avatar for Narue
0
76
Member Avatar for Davidsen
Re: How

>Is there a way to make a text based RPG game? No, it's impossible. :icon_rolleyes:

Member Avatar for Narue
0
63
Member Avatar for faisaly

>Please explain me briefly. I believe the customary response to such a lazy question is "Do your own damn homework!".

Member Avatar for Narue
0
72
Member Avatar for atman

>More strong (but not ideal) method is (an example only) Only an example because by the time you test for overflow, the damage is already done. Keep in mind that once you invoke undefined behavior, the rest of the program is undefined. You need to test before the damage is …

Member Avatar for ajay.krish123
0
119
Member Avatar for Ancient Dragon
Member Avatar for tat2dlady

That's not a portable operation, so we can't offer suggestions without at least knowing your operating system. Also knowing your compiler wouldn't hurt either.

Member Avatar for Narue
0
116
Member Avatar for coachHinesfan
Member Avatar for chunalt787

The vector class is in the std namespace. Change [ICODE]vector<FrequencyNode> list;[/ICODE] to [ICODE]std::vector<FrequencyNode> list;[/ICODE]. You have other errors though.

Member Avatar for chunalt787
0
121
Member Avatar for clutchkiller

int is a type built right into the language, which means you don't need to link with a library to use it. string (or std::string, to be specific) is a class in the standard library that gives you a string type. Ultimately the difference is minimal, aside from the fact …

Member Avatar for clutchkiller
0
128
Member Avatar for inumbris

It's just a quirk of the text highlighting. I've found that when I'm mucking about with preprocessor directives, the highlighter can't always keep up with me and even though the code is correct, the highlighting is wrong.

Member Avatar for ArkM
0
255
Member Avatar for The Dude

>im originally from the south of england so i should be smart Your accent probably makes you [I]sound[/I] smart. Don't be deceived! :icon_rolleyes:;)

Member Avatar for Obeledeveloper
0
155
Member Avatar for OreWaChoOtakuDa
Member Avatar for minas1

>but (as I've read) pointer arithmetic is faster Prove it. In your example, the two are quite likely compiled to exactly the same machine code. Array subscripting is literally syntactic sugar for the equivalent pointer offset calculation. A more likely example is this: [code=cplusplus] int x[N]; int *p = x; …

Member Avatar for ArkM
0
1K
Member Avatar for smart_pc

>We need a programmer who is SMART in ASSEMBLY LANGUAGE Then why are you asking in a C forum?

Member Avatar for ArkM
0
108
Member Avatar for Somersett

>Am I write[[I]sic[/I]] in thinking this? Makes sense to me. Though structures are best used for closely related data rather than just a variable dump. If the relationships aren't there, you may need to consider how you're structuring your program and redesign if necessary to streamline the flow.

Member Avatar for Somersett
0
291

The End.