15,300 Posted Topics
Re: fstream parameters require const char*, not string. So pass the c_str() method [icode]ifstream myfile1 (path1.c_str(), ios::binary)[/icode] [edit]^^^ what Narue said.[/edit] | |
Re: >>int players[1]; Why is that an array? might as well just declare it as a simple integer instead of an array of 1 element. >> if(p1color=='R' || 'r') That's incorrect. Here's the correction: [icode] if(p1color=='R' || plcolor=='r')[/icode] | |
Re: >>(NOte: If I remove _stdcall its working fine) Then what's the problem? Leave _stdcall out then. | |
Re: what operating system? If MS-Windows you can call win32 api function CopyFile() to copy the file from one computer to the other by specifying the full path including drive letter in the filename parameter. | |
Re: you have to include <string> because your program uses it. please post input file. | |
Re: what makes you think your program is working? The loop on line 21 doesn't stop when you press the <Enter> key. And if you just type in a bunch of crap you get this: [code] Please enter string for storage: lkaslkjas;lkfjaslkfjas;lkjfg;lkjglkjerpoitjergokjjgk;lkeo;ijtoijtrhoijrt;hoijrth oijtgoijegoijewgoiejgoierjgpoijergoijergoijwegpoijwergpoiwjergpoiwejg The first 81 characters of the string entered … | |
Re: That's a very common programming assignment and you will find a lot of help if you just learn to use google. [URL="http://www.google.com/search?hl=en&q=c+program+to+get+combinations&btnG=Google+Search"]Links here[/URL] | |
Re: you don't declare it like that. First just declare the vector object [icode]vector <problem> problems;[/icode]. Then later on you can add classes to it [code] vector <problem> problems; problem person; for(;;) { // enter each of the attributes of the person object is not shown // add a class object … | |
Re: >>I don't know what to write to achieve this That's not the only thing you don't know how to write. Your program is littered with tons of errors. Don't try to write that much code without compiling it firs, and fix all the errors so that the compiler does not … | |
Re: [QUOTE=DaveCachia;570683]If anyone else has suggestions as to where I should start and how I should go about doing this.. it would be more than appreciated. Group members are not helping :([/QUOTE] What's your hurry! Don't expect immediate answers to your questions, sometimes it might take a few hours depending on … | |
Re: I was 42 when I retired from the USAF in 1985 and began my programming career. First got an intro job for a temp agency in St Louis then a contracting company. In 1997 landed a job for a company that had a large government contract in my area -- … | |
Would it be possible to limit the searches to a specific forum, such as just the forum I happen to be viewing at the time ? | |
Re: rand() never generates number in sequential order -- if it did then the numbers wouldn't be random. What you need to do is put the generated data into an array the sort the array by height. Or put the numbers in the linked list in numerical order instead of just … | |
Re: swapping character arrays can not be done with the = operator. Instead you have to call strcpy() to copy them. [code] strcpy(cExtraName,cRunner1); strcpy(cRunner1, cRunner2) strcpy(cRunner2, cExtraName); [/code] As for your first problem you will have to post all the code so that we can find the problem. If you don't … | |
Re: You can download the C source code for QStat from [URL="http://www.qstat.org/"]here[/URL]. All you have to do is port it to VB and you won't have to hack away at it. Or port it to C# which might be even easier to do. | |
Re: >>q2: I am also having having trouble convert a int to a string and i looked it up but i am >>not sure how to use itoa or sprintf This is c++, so don't use either itoa or sprintf. Use stringstream instead [code] #include <sstream> <snip> int main() { int … | |
Re: [URL="http://libodbcxx.sourceforge.net/"]Free ODBC c++ class here[/URL] | |
Re: you need to make more generous use of { and } [code=cplusplus] void blur(int src[], int rows, int cols, int dest[]) { int count; for (int i = 0; i<rows; i++) { for (int j = 0; j<cols; j++) { for (int count = 4; count <= i*cols + j; … | |
Re: You'll have to explain a little better because I don't see the problems you report. | |
Re: menu items 4 and 5 are probably the most difficult and I would leave them to last. But the others aren't all that hard. Take #1 -- append text to the end of a file. The answer to that is all in how the output file is opened. [URL="http://www.cplusplus.com/reference/iostream/fstream/open.html"]Look at … | |
Re: >>then what is the difference between both styles ?? The first is most definitely an array. The second may or may may not be an array because it could also be a pointer to a single int object. [b]function()[/b] must be made smart enough to know whether *p is a … | |
Re: See [URL="http://www.programmersheaven.com/mb/mfc_coding/189694/189694/ReadMessage.aspx"]this thread [/URL]and [URL="http://support.microsoft.com/default.aspx?scid=kb;en-us;190351"]this M$ link[/URL] also [URL="http://www.codeproject.com/KB/debug/mfcconsole.aspx"]here[/URL] | |
Re: >>Any Idea why this section of code would give me these linker errors Yes. You have to add Use Ws2_32.lib as described in the [b]Requirements[/b] section [URL="http://msdn2.microsoft.com/en-us/library/ms742213.aspx"]here[/URL] | |
Re: >>How i can solve it? By adding the library to the link statement. How to do that depends on the compiler you are using and possibly the makefile. | |
Re: >>Viruses may trash your hard disk Oh yes -- what was a [b]feature[/b] built into MS-DOS 6.X and Windows 95. I can't count the number of times I had to reformat the hard drive and reinstall everything from scratch. I have not had that problem since Windows 2000. | |
Re: try deleting all the *.obj and *.pch files then recompile everything. | |
Re: try [URL="http://www.google.com/search?hl=en&q=shareware&btnG=Google+Search"]these shareware sites.[/URL] | |
Re: You need a game engine such as DirectX SDK (free for the downloading from Microsoft). But be prepared for some very heavy-duty c and c++ coding. The SDK that you download includes quite a few example program to illustrate how to use the SDK. Also check out the [URL="http://www.daniweb.com/forums/forum71.html"]Game Development … | |
Re: You are not validating the return value of strtok(). It returns NULL if its at the end of the string when you call strtok() with a NULL first parameter (or some other error occurred). It would be more prudent to code it like this: [code] char* ptr; while(fgets(b2b_rates_address,1000,in_fp) != NULL … | |
Re: int main() is declared wrong. There are only two acceptable ways to declare it [code] int main() { } int main(int argc, char* argv[]) { } [/code] >>int term1* You don't declare a pointer like that -- you have the asterisk in the wrong place: [icode]int* term;[/icode] | |
Re: [b]this[/b] is a hidden parameter that is passed to every [b]non-static[/b] method of a c++ class. It is used to point to a specific instance of a class and all its data object. In your specdific problem FindParent() is called from a specif node in the list, and the [b]this[/b] … | |
Re: getch() is a non-standard function by Borland therefore not all compilers support it. | |
Re: >> would like to put the last two lines in a While Loop to prevent the user from going over >>the 20 character limit, When you use getline() that isn't necessary because getline() will no accept more than iLength number of characters including the string null terminator. | |
Re: probably memory has been corrupted before executing that line. The most common cause is buffer overruns -- writing beyond the end of a buffer or an array. | |
Re: [URL="http://www.codeproject.com/KB/stl/stdsort.aspx"]Tutorial and example here[/URL] | |
Re: >>if (Y = 'Y') Sorry, Rajith, but that's not how to do it. You need the == operator, not the assignment operator. | |
Re: [QUOTE=look@me;566840]i have a small problem in my ass and i dont know how to solve it [/quote] That's not very descriptive of the problem. You need to be a bit more specific about what you can not do or understand ? | |
Would you please explain what this is for? I presume its a list of links to people's web sites. Why would you want that? Is it another place for people to advertise their web sites? ![]() | |
Re: >>Visit this site, it really fits well to my needs: Ok, so it won't accept the word "bloody" but it will accept "f***k". Some crappy filter that is :) bloody is not a naughty word but the other is. | |
Re: [QUOTE=williamhemswort;566451]Make a 2D array. char fname[100][50]; fname[0] = "First Name1"; fname[1] = "First Name2"; ... and so on[/QUOTE] you have to use strcpy() to set those char arrays [code] strcpy( fname[0], "First Name1"); strcpy( fname[1], "First Name2"); [/code] | |
Re: line 1: its either <cstdio> or <stdio.h> line 13: [URL="http://www.gidnetwork.com/b-66.html"]void main[/URL] -- read the link lines 28, 31 and 34: [URL="http://www.gidnetwork.com/b-56.html"]gets()[/URL] -- read link >>But i am not able to handle the debugging in VC++. >>How should i do? Read some of [URL="http://www.google.com/search?hl=en&q=vc%2B%2B+debugger+tutorial"]these links[/URL] | |
Re: >>line 4: test_string.length Length is a function call, not a data object. [icode]test_string.length()[/icode] | |
Re: Your program never opens the input file. Where's the infile.open() statement? The while statement in ReadAllOfFile() is incorrect. The eof() doesn't work that way. Here is how it should be coded. You should change readFile() to return the reference to ifstream instead of the structure and pass the structure by … | |
Re: The libraries depends on the operating system which is why neither c nor c++ supports TCP/IP and networks directly. For MS-Windows just use win32 api functions found in winsock.h, which is pretty compatible with Berkley Sockets standard. I don't know if there is a platform-independent socket library, but I suppose … | |
Re: >>What happens to it's value once an element is deleted ? The iterator is invalidated and you have to start it all over again. Example here: The program will crash after the erase() is executed unless the break statement is there to stop the loop. [code] #include <vector> #include <iostream> … | |
Re: Don't get overwhelmed by the complexity of the problem, but break it down into smaller units that you can deal with. For example, first write a program that just has a menu inside a loop. The menu should ask to either quit the program or find another name. Get that … | |
Re: >>Does this take up any RAM memory just because I have declared this number of >> elements Yes -- it will take up (1000000 * sizeof(string)) + sizeof(vector) before any of the strings have been initialized with anything. | |
Re: Did you look on that line in your program and see what variable or symble it thinks is undefined ? |
The End.