15,300 Posted Topics

Member Avatar for dardar4

Create a new project but instead of a console project create a static library, then add the files to it. Or, if the files are small enough just add them to your console project as if you wrote them yourself. That way you don't have to bother making libraries out …

Member Avatar for hichnam
0
118
Member Avatar for mohammad1982

IMO you need to stop using Dev-C++ and get Code::Blocks. Code::Blocks is a better IDE, uses newer version of MinGW compiler (g++), and has a better debugger. That will solve your 2nd problem. As for your first problem, why didn't you add the other *.cpp files to the project?

Member Avatar for Frederick2
0
113
Member Avatar for codysundermann

lines 24 and 33: is_open() does not take any parameters. line 30: you can not put string literal on that line. You have to replace that string literal with a variable name, something similar to what you did on line 21. There are probably other errors -- I stopped reading …

Member Avatar for Ancient Dragon
0
81
Member Avatar for nestafary

I assume you want to delete a line from a text file, right? In that case all you have to do is completly rewrite the file, omitting the line you want to delete.

Member Avatar for Ancient Dragon
0
32
Member Avatar for *Moonlight*

What data type is [b]date[/b]? Can we assume it is a character array since you want to enter in mm-dd-yyyy format? After entering the date it needs to be split up into month, day and year integers. Then to test for yeap use use the mod operator % on the …

Member Avatar for *Moonlight*
0
881
Member Avatar for StaticX

if this->name is a pointer (i.e. char*) then you have to allocate space for it before copying the string. Just setting with = as in your example will not work. [code] Name::Name(char* nm){ this->name = new char[strlen(nm)+1); strcpy(this->name,nm); } [/code] >>Ideally i would like to stay away from the use …

Member Avatar for StaticX
0
175
Member Avatar for jonsca

[QUOTE=cscgal;1055162]No worries ... we always love feedback so anytime you have anything to say, please be my guest ... and know that you're being heard. :)[/QUOTE] Yea, right. Like you [URL="http://www.daniweb.com/forums/thread239524.html"]ignoring this thread[/URL].

Member Avatar for Narue
1
134
Member Avatar for Ggiirr

Two things wrong with the if statement on lines 120 and 124 1) if statements must have ( and ). e.g. [icode]if( condition )[/icode] 2) = is an assignment operator, == is a boolean logic operator. You want to use == in if statements

Member Avatar for Ggiirr
1
145
Member Avatar for coldkiller

Not possible to move the mouse without using some lib or function. There are no c functions to do that, nor are there any native MS-DOS assembly language system calls that support the mouse. Your only option is to call one of the mouse device driver's functions, assuming a device …

Member Avatar for Frederick2
0
322
Member Avatar for greko2009

Notice there are four 2-byte entries not just three. So either the format is incorrect or you didn't post the correct file contents. how you read the text might be something like this: [code] char text[255] = {0}; myfile.read(text, msglen); text[msglen] = 0; // null-terminate the string [/code]

Member Avatar for greko2009
1
320
Member Avatar for squigworm

>>Does this function call and definition not match ? Bingo :) My guess is that you have two overloaded functions named bookinfo, but neither of them have exactly the same arguments as the one your program is attempting to call. Notice that one passes some parameters by reference while the …

Member Avatar for lotrsimp12345
0
156
Member Avatar for BobRoss

Of course it can't be deleted because the program has it open. You have to close the file before attempting to delete it. [edit]And what ^^^ said too.

Member Avatar for BobRoss
0
136
Member Avatar for merse

Using c++ classes is going to be a little slower than C functions becuase c++ has a little more overhead to contend with. Also make sure your compiler is optimizing the code to use the computer's math coprocessor for floating point math instead of using an emulator library.

Member Avatar for merse
0
170
Member Avatar for CppFTW

could be that you didn't add the boost libraries to your program's project. Did you compile them after installing boost?

Member Avatar for kevint77
0
509
Member Avatar for kavourdoukos

delete them in the opposite order that they were allocated. use [b]delete[/b] inside the loop, but [b]delete[][/b] to delete the array itself. 2) Not possible. You should create another method which can be called after the memory is allocated.

Member Avatar for kavourdoukos
0
86
Member Avatar for PDB1982

You can't really use a switch statement based on averages. Its better to use a series of if statements so that you can gest ranges of values [code] if( average > 90) return 'A'; else if( average > 80 ) return 'B'; // etc etc [/code]

Member Avatar for jonsca
0
122
Member Avatar for llemes4011

It probably doesn't really matter one way or the other, the compiler will probably optimize them both the same. Whether or not to use a pointer should depend on other factors. But consider that pointers are a little more dangerous because programmers often fail to clean up when done with …

Member Avatar for Narue
0
165
Member Avatar for shmeeps

>>The loop works fine No it doesn't. That loop may read the last line of the file twice, assuming there are fewer than MAXENTRIES number of lines in the file. My guess is that you have just dummied up the code you posted without bothering to copy/paste from the code …

Member Avatar for shmeeps
1
186
Member Avatar for Stivdion

edit your post to include code tags [noparse][code] // your code goes here [/code][/noparse] where (which line) does the error occur?

Member Avatar for Stivdion
0
236
Member Avatar for C++NOOOB

you need to typecast the base class pointer into a derived class pointer before it can call functions unique to the derived class. Base class knows nothing about those functions. [icode]derived_class *pDerived = reinterpret_cast<derived_class*>(obj);[/icode] [code] int main(void) { base_class *obj; obj = new derived_class (10); derived_class* pDerived = reinterpret_cast<derived_class*>(obj); obj->func_1(); …

Member Avatar for Ancient Dragon
0
130
Member Avatar for Tauren

Of course if you are curious enough you could ask [URL="http://www.google.com/search?hl=en&q=how+to+write+an+operating+system+in+c&btnG=Google+Search"]google [/URL]your question and study the links it gives you. I found at least a half-dozen articles in just a few seconds. Most universities officer course in operating systems. You might take one of those courses, but you will need …

Member Avatar for Ancient Dragon
0
546
Member Avatar for gsingh2011

>>line 35: ofile.write((char*)&g[0], sizeof(g[0])); sincfe g[0] is a pointer, sizeof(g[0]) is the same as sizeof(any pointer) which is normally 4 with a 32-bit compiler. What you want there is sizeof(graph). But that won't really do what you want either because it doesn't include the edgenode array other than that array …

Member Avatar for Ancient Dragon
0
116
Member Avatar for Dom83

Here is one way to do it -- use stringstream class [code] #include <sstream> #include <string> #include <iostream> #include <iomanip> using namespace std; int main(int argc, char* argv[]) { int day = 20; int month = 1; int year = 8; stringstream str; str << setw(2) << setfill('0') << year …

Member Avatar for Dom83
0
112
Member Avatar for wh33lz

simple colution [code] int main() { int num; char chars[] = "abcdefghijklmnopqrstuvwxyz"; cout << "How many strings do you want to create?\n"; cin >> num; long n = 0; for(int i = 1; i < num+1; i++) { for(int j = 0; j < i; j++, n++) cout << chars[n%26]; …

Member Avatar for evilctofwoc
0
6K
Member Avatar for merse

No you don't have to use () on your own c++ classes. [code] class MyClass { public: MyClass() { cout << "Hello World\n"; } }; int main() { MyClass c; } [/code]

Member Avatar for mrnutty
0
101
Member Avatar for iassael

You mean like this? [code] void openPasswd(char* users[],char* names[], int maxitems) { } int main(int argc, char* argv[]) { const int MaxItems = 20; char *users[MaxItems] = {0}; char *names[MaxItems] = {0}; openPasswd(users, names, MaxItems); return 0; } [/code]

Member Avatar for twomers
0
115
Member Avatar for Petesey

Did you run the vista compatability program? It would have tested the computer's hardware and given you a report of what needs to be fixed.

Member Avatar for bradwall3
0
126
Member Avatar for shakunni

On *nix you can call the function opendir() to check if a directory exists. You can use fopen() to do that. I believe stat() will also work on directories.

Member Avatar for Ancient Dragon
0
107
Member Avatar for dackle

You trying to create a game? You can use game generators like DirectX or OpenGL (google for them, both are free). You might also want to google for sprites.

Member Avatar for Ancient Dragon
0
34
Member Avatar for hajiakhundov

How do you know Sleep() doesn't work?? Recall the parameter is milliseconds -- there are 1000 milliseconds in one second.

Member Avatar for hajiakhundov
0
137
Member Avatar for dark1806

[b]which[/b] is not difficult to implement. Just get the environment variable PATH, then check each of the directories for the given file and report the directory for the first hit. The file might be contained in more than one directory, but all you want to report is the first one. …

Member Avatar for Ancient Dragon
0
130
Member Avatar for react05
Member Avatar for Ancient Dragon
0
107
Member Avatar for iluv2laugh

>>Is it incorrect to pass "hFind" as the first parameter to GetFileTime()? No. You need to read msdn for the functions you want to use. [URL="http://msdn.microsoft.com/en-us/library/ms724320%28VS.85%29.aspx"]Read this[/URL]. It clearly states the hFile parameter must have been obtained by CreateFile().

Member Avatar for Ancient Dragon
0
231
Member Avatar for meghs007

Compare each string one character at a time in a loop. If one string contains a ? then assume it is matched with whatever character is in the other string. If one character contains a * then look at the next character (in your example its a 'g'), then in …

Member Avatar for Ancient Dragon
0
74
Member Avatar for raigs

deleted line 12 -- srand() does that. And its in the wrong place too -- it should appear at the top of main() because srand() should only be called once during the lifetime of the program.

Member Avatar for Ancient Dragon
0
119
Member Avatar for muffinhead

line 7 and 8 of the read function: Line 8 is unnecessary because line 7 opens the file when the stream is declared. line 12: if lastname never contains spaces then use use >> operator instead of getline(). line 13: doesn't make any sense. [b]names[/b] is an array, but you …

Member Avatar for Ancient Dragon
2
121
Member Avatar for samsons17

[QUOTE=basketball4567;1061785] [B]void main()[/B] just means that the programming doesnt return any value.[/QUOTE] Never ever recommend [b]void[/b] main() because it isn't recognized by either C or C++ standards. [URL="http://users.aber.ac.uk/auj/voidmain.shtml"]Read this article[/URL].

Member Avatar for Ancient Dragon
0
156
Member Avatar for Jiwe

>>sizeof("C:\\Windows\\filenamehere.exe"); That will not produce the value you want -- the sizeof(any pointer here) is the same for all pointers (most likely 4). It would be easier to just declare a variable to hold that string so that you don't have it in your program twice. [icode]char filename[] = "C:\\Windows\\filenamehere.exe";[/icode] …

Member Avatar for Jiwe
0
2K
Member Avatar for foxmulder

Must mean integers, because there are an infinite quantity of floats or doubles between two numbers. The word [b]amount[/b] is ambiguous. Does it mean [b]sum[/b] or [b]quantity[/b] ? For example, there are 11 numbers betwen 0 and 10, but the sum is 1+2+3...+10 = 55

Member Avatar for samsons17
0
142
Member Avatar for nunchuckie

Read the file sequentially from beginning to end, counting lines as you go along. If you want to read the 2d line then you will have to read lines 1 and 2. It is not possible to skip to a specific line in a text file.

Member Avatar for nunchuckie
0
137
Member Avatar for adi.shoukat

what "catch" ? There are lots of them on the computer. You can't get access to most of them because they are part of the os.

Member Avatar for Narue
0
187
Member Avatar for roverphoenix

Here are just a few suggestions: line 46: >> gets(str); Never ever use gets(). What will happen if I enter more characters than the buffer can hold? Answer: Seg Fault. Use fgets() instead because it will limit the input to the max length you want. line 49: has no value …

Member Avatar for Ancient Dragon
2
248
Member Avatar for red999

[QUOTE=NicAx64;1061414] as I remember unix files uses \r\n and dos only uses \n. so that's why you get an difference. [/quote] Your memory is a little fuzzy -- its just the opposite. MS-Windows/MS-DOS: \r\n *nix: \n MAC: \r [quote]You will get a extra single character or two depending on you're …

Member Avatar for Ancient Dragon
0
145
Member Avatar for Mathura

[URL="http://www.builderau.com.au/program/java/soa/Writing-complex-interrupt-handlers-in-C/0,339024620,320268033,00.htm"]Here [/URL]is one example of how to do it. I hope you are familiar with assembly language.

Member Avatar for Mathura
0
129
Member Avatar for gen84
Member Avatar for mrnutty
-3
97
Member Avatar for r00ty

Read both files at the same time as firstPerson mentioned, then compare the lines as they are read; no need to put them in a vector unless you intend to do something else with them.

Member Avatar for r00ty
0
161
Member Avatar for Snippset

Of course you can't really delete an element in an array, just shift all remaining array elements up to write over the element you want deleted and leave an empty element at the end of the array. If you have an array with 5 elements and you want to delete …

Member Avatar for Snippset
0
99
Member Avatar for martidim

>>Thanks in advance ! Dump vc++ 6.0 -- its old, outdated and does not support c++ very well. Another suggestion: Go to [url]www.winpcap.org[/url], click on their Support link and join their mailing list. Get answers to your questions from the people who should know.

Member Avatar for Ancient Dragon
0
158
Member Avatar for grib

Your head is wrapped around it wrong. I don't know how you got 19 mpg -- 160.9/3.27 is 49, not 19.

Member Avatar for Nick Evan
1
133
Member Avatar for Kennych

1) use ifstream, not fstream, to read a file. ifstream is easier to use. 2) use getline() to read an entire line that may or may not contain spaces. [code] ifstream in("test.txt); getline(line1, in); // do the same for the other lines [/code]

Member Avatar for Ancient Dragon
0
278

The End.