15,300 Posted Topics

Member Avatar for jephthah
Member Avatar for annbytes
0
221
Member Avatar for lotrsimp12345

Normally overload operators so that you can do mathematical or other operations with c++ classes. for example: [icode]cout << MyClass;[/icode] assuming MyClass is an instance of some c++ class and you want that class to print the value of its class variables to the screen. Or you might want to …

Member Avatar for lotrsimp12345
0
183
Member Avatar for JackDurden

You are attempting to treat a <vector> as if it were a <set>, which is not possible. [code] #include <iostream> #include <vector> #include <string> using namespace std; int main() { vector<vector<char>> vset; vector<char> element; vset.resize(255); element.push_back('a'); element.push_back('b'); element.push_back('c'); vset['A'] = element; element[0] = 'e'; element[1] = 'e'; element[2] = 'f'; …

Member Avatar for Ancient Dragon
0
187
Member Avatar for sdmahapatra

>>"(1) how to capture number of occurrences of 3 between 1 to 100? " Write a for loop that counts from 1 to 100. Convert each int value to a string then test the string if it contains a '3'. 2) Do you know how to declare a function pointer? …

Member Avatar for mrnutty
0
125
Member Avatar for Nathan Campos

First, open the file for reading in binary mode. Second, open the output file for writing in binary mode declare an unsigned char array of size 255 create a while loop and continue while reading [code] while( infile.read( buf, sizeof(buf) ) { size_t len = infile.gcount(); // get the number …

Member Avatar for Nathan Campos
0
141
Member Avatar for Ancient Dragon
Member Avatar for Nathan Campos

[code] int main( int argc, char* argv[] ) { char* inputFile; char* outputFile; inputFile = argv[ 1 ]; outputFile = argv[ 2 ]; ifstream in(inputFile); if( in.is_open() ) { ofstream out(outputFile); out << in.rdbuf(); } //ofstream(outputFile) << ifstream(inputFile).rdbuf(); return 0; }[/code]

Member Avatar for Nathan Campos
0
100
Member Avatar for papanyquiL

The parameter to [URL="http://msdn.microsoft.com/en-us/library/ms682629%28VS.85%29.aspx"]EnumProcesses[/URL]() is not a function pointer, but a pointer to an array of DWORDs. That link contains a simple example program to demonstrate how it works.

Member Avatar for Ancient Dragon
0
214
Member Avatar for nihan1
Member Avatar for kamo10

There are a couple ways to use SQL databases such as MS-Access. 1)[URL="http://www.google.com/#hl=en&q=odbc+tutorials&aq=f&oq=&aqi=&fp=-Pw1cEIpNGU"] ODBC [/URL]and 2) [URL="http://www.google.com/#hl=en&q=ado+tutorials&aq=f&oq=&aqi=&fp=-Pw1cEIpNGU"]ADO[/URL] Since you didn't bother to tell us what you did or post any code, I'm not going to bother explaining how to do it other than giving you some google links.

Member Avatar for Ancient Dragon
0
86
Member Avatar for farhan.foxtrot

main() is passing an array of ints to that function, but the function is using it like its a pointer to a single int. >>The code is taken from Dennis Ritchie's "C Programming Language" 's page 97 (2nd Edition). I doubt it -- he is a hell of a lot …

Member Avatar for 9868
0
185
Member Avatar for Ancient Dragon

A while back when I changed and saved my signature it was changed on every post that I had made. I just now changed it, but nothing happened in existing posts. Was the previous behavior because I was a mod or has something else changed here at DaniWeb ?

Member Avatar for Ancient Dragon
0
109
Member Avatar for ryancfc

I was also having problems today setting up NetBeans with MiniWG. Even after installing the MSYS version of make, NetBeans refused to successfully compile a simple Hello World program. So I deleted MiniWG and installed cygwin, and had everything going in about a half hour. I have not tried debugging …

Member Avatar for Ancient Dragon
0
99
Member Avatar for snvngrc1

You won't get much help by posting all that unformatted code. Learn to use code tags. You still have time -- go back and edit that post to add the tags.

Member Avatar for snvngrc1
0
175
Member Avatar for Koinutron

Get the input as a string then check each of the characters. If all is ok then convert that string to int (or other data type). Something along these lines. [code] #include <iostream> #include <string> #include <sstream> using namespace std; int main() { int gallons; std::string input; cout << "Enter …

Member Avatar for Koinutron
0
144
Member Avatar for invisi

That will be too slow. If you are on Windows os then try [URL="http://msdn.microsoft.com/en-us/library/dd183370%28VS.85%29.aspx"]this function[/URL] Or maybe [URL="http://www.codeproject.com/KB/clipboard/hscr2clp.aspx"]this program[/URL]. And I hope you intend to use the same file every time. You will fill up a hard drive pretty quickly if you use a different names.

Member Avatar for Ancient Dragon
-1
160
Member Avatar for yeshkadiyala

>>anything wrong in the program? 1. its [icode][color=red]int [/color] main().[/icode] 2. Add [icode]return 0;[/icode] as the last line in main() 3. Add '\n' to the end of Hello, making it "Hello\n" 4. You might need to add [icode]fflush(stdout)[/icode] after that print statement. If the above doesn't fix the problem then …

Member Avatar for Salem
0
168
Member Avatar for Nathan Campos

Suggest you use getline() to read the entire line, then use stringstream object to split it into words. [code] std::string line; ifstream in("file.txt"); while( getline( in, line) ) { std::string word; stringstream str(line); while( str >> word ) { // now do something with this word } } [/code] As …

Member Avatar for Nathan Campos
0
101
Member Avatar for mybluehair

getch() returns 224, not 0, when an arrow key is pressed. So the program has to check for both values (0 and 224) Also, getch() returns an int, not char.

Member Avatar for mybluehair
0
2K
Member Avatar for avaitla

right click on the project name, then select Properties at the bottom of the menu. In the Categories box select Linker, then on the right side click the button with "..." next to "Libraries" (near the bottom) , In the popup window select "Add Library" and there you can add …

Member Avatar for Ancient Dragon
0
220
Member Avatar for PetuniaRose

[QUOTE=PetuniaRose;939155]I see folks replying to threads with quotes that have the name of the original poster included - they have the form nameOfPoster> quote I've been crawling around the faq for the past hour or so, and haven't found any really newbie guides for using all the neat stuff that's …

Member Avatar for Ancient Dragon
0
120
Member Avatar for nihan1

google for "ODBC c++ classes". Then in the OnClick event handler do the sql queries via odbc and fill the listbox or whatever.

Member Avatar for Ancient Dragon
0
2K
Member Avatar for Stefano Mtangoo

>>Should I uninstall wxWidgets after buidling? Not unless you never want to use it again. If your computer is running out of space then there are other files that should be removed before wxWidgets, such as all the compiler-generated files. If you are using Microsoft compiler then it will generate …

Member Avatar for Hiroshe
0
121
Member Avatar for Frederick2

why is that class declared extern "C" ? C programs can't call c++ classes, to that declaration is pointless.

Member Avatar for dumrat
0
1K
Member Avatar for MosaicFuneral
Member Avatar for Dani
0
182
Member Avatar for Hiroshe

I'm not a thrill-seeker, never have been. Even a faris wheel scares me when it stops me at the top.

Member Avatar for sknake
0
187
Member Avatar for furqankhyraj

This is one of the problems with learning to program with an ancient compiler such as Turbo C -- you don't know the difference between compiler-specific functions and standard C.

Member Avatar for Ancient Dragon
0
166
Member Avatar for Silvershaft

Forget making games for now and just concentrate on learning the language. You have to learn how to crawl before you can start running.

Member Avatar for swinefish
0
105
Member Avatar for tazboy

fstream objects are normally passed by reference, not by pointer. [icode]void delete_record( istream& file, string keyword ){[/icode]. This allows you to use [b]file[/b] just as if it had been declared inside the function and removed the indirection star. [icode]while ( *file >> fname && file->peek() != EOF )[/icode] It is …

Member Avatar for Ancient Dragon
0
91
Member Avatar for nnhamane

>>Do you have any solution for my problem? Yes -- compile for debug and use the compiler's debugger. Sorry, but that's about the best I advice I can give you without seeing the code and debugging it for you.

Member Avatar for Ancient Dragon
0
142
Member Avatar for azjherben

I get this error with the link you posted [quote] [b]403 Forbidden![/b] The address you have entered is not open to the public, (This may be caused by not having a index.html file in your root directory). We advise you to visit our home page, as you could still find …

Member Avatar for Ancient Dragon
0
260
Member Avatar for Leniel

Next time use code tags. line 36: where is year declared? line 46: why delete year immediately after entering its values?

Member Avatar for Leniel
0
186
Member Avatar for tugue

And next time [URL="http://www.daniweb.com/forums/forum38.html"]post in the right forum[/URL].

Member Avatar for Ancient Dragon
0
105
Member Avatar for crazyboy

Don't limit yourself to just c++. Also take courses in C#, VB, Java. HTML, and other languages to broaden your skills. And toss in a course or two in databases, such as SQL language. The more you know the better your resume will look to potential employers.

Member Avatar for Ancient Dragon
0
143
Member Avatar for nova2177

change_r() is pointless. All it does is return the same value that was passed in as the parameter.

Member Avatar for nova2177
0
111
Member Avatar for makavelixx

post some of the error messages. Function Search() -- Is [b]state[/b] supposed to be one of the 50 USA states? If yes, then it can not be an integer, but must be 2 character array followed by a null terminator (total of 3 characters). If not, then you need to …

Member Avatar for makavelixx
0
97
Member Avatar for sara9111
Member Avatar for jen140

>>Include winuser.h That should not be necessary since he's already including windows.h >>Im using Visual Studio Professional edition. Which version -- there are several of them. >>but there are some errors rising while compiling it, the two most importants are : Are there other errors listed before the two you …

Member Avatar for jen140
0
255
Member Avatar for Antun

If you are trying to learn c++ with Tubro C++ then forget it. That compiler is non-standard and too old to do anyone any good. Get a modern free compiler such as Code::Blocks or Microsoft VC++ 2008 Express if you want to learn c++ the modern way. And what you …

Member Avatar for JameB
0
121
Member Avatar for dchunt

cout does nothing in windows programs because they do not have a console window, nor do they have a main() function. [URL="http://www.codeguru.com/forum/archive/index.php/t-191786.html"]Here are some hints [/URL]how to draw text on windows canvas.

Member Avatar for Ancient Dragon
0
101
Member Avatar for huzeifa

Works for me [icode] MessageBox(0,"Hello\nWorld","MyProgram",MB_OK);[/icode]

Member Avatar for Ancient Dragon
0
69
Member Avatar for julia2009

No. That feature does not exist in C or C++ languages. In C++ the nearest thing I can think of would be <map> that maps a name with a string (or other item). But that's not really the same because you can't use it like a variable.

Member Avatar for Ancient Dragon
0
46
Member Avatar for dchunt

Open the file in binary mode, not text, then read each byte into an unsigned char, which has a value 0-255. If you want to count the number of occurrences all you need is an array of 255 and use the char as the index into the array [code] int …

Member Avatar for Ancient Dragon
0
100
Member Avatar for goody11

OMG what in the world are all those getline() calls???? If you want to put all those strings into the vector then use a loop! Use a string object to read the string and delete that damned character array (sztemp) which just takes up useless stack space. Replace lines 19 …

Member Avatar for goody11
0
698
Member Avatar for kylelyk

>>[Linker error] undefined reference to `WinMain@16' You created the wrong kind of project -- create a new [b]console[/b] project then copy/paste that program into it. >>should I put that on line 25 of my code or right after mian ends? Exactly as shown. Read the [URL="http://alleg.sourceforge.net/"]allegro tutorials here[/URL]

Member Avatar for kylelyk
0
165
Member Avatar for huzeifa

What functions are you using to do the copying? win32 api [URL="http://msdn.microsoft.com/en-us/library/aa363852(VS.85).aspx"]CopyFileEx()[/URL] will call your function for each portion of the file that has been copied, allowing it to update the progress bar.

Member Avatar for Ancient Dragon
0
110
Member Avatar for hashinclude

[QUOTE=hashinclude;366172]hello , first i want to say that im very new at c++ , i managed to create a very simple program through searching the internet , this little program involves running a certain exe file with parameters : (e.g: "c:\folder\file.exe" -parameter1 -parameter2) i am using the system() function to …

Member Avatar for epitalon
0
183
Member Avatar for mairtin.obrian

I don't know a thing about it, but did you check [URL="http://www.google.com/search?hl=en&q=Web+Site+Scraping+software+"]google[/URL]?

Member Avatar for RonVelder
0
195
Member Avatar for harryhaaren

>>These headers will "load" other headers..? Is this illegal? Yes. Many standard system header files include other header files. >>in this case its not bad, but if im using some audio processing function, it could name-clash with a similar function for midi.) There will be no name clashes because that's …

Member Avatar for kvprajapati
0
121
Member Avatar for goody11

This works. But frankly I don't like using those win32 api file i/o functions because standard c++ std::fstream is a lot easier to work with. [code] #include <windows.h> using namespace std; int main() { HANDLE hFile = CreateFile("TextFile1.txt", GENERIC_READ|GENERIC_WRITE, 0,0,OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); if( hFile != INVALID_HANDLE_VALUE) { char text[] = …

Member Avatar for Ancient Dragon
0
180

The End.