1,177 Posted Topics

Member Avatar for nerden

I'm not sure how to do this, but looks like this is what you want: [url]http://www.devx.com/vb2themax/Tip/18773[/url]

Member Avatar for nerden
0
130
Member Avatar for johnray31

You're map is supposed to store a string and a ConfigPaths* , but you are trying to pass it s1 (a string) and m1 (a ConfigPath, NOT a ConfigPath*) I've never used that ::value_type, so I could be wrong, but thats the first thing I'd look at.

Member Avatar for johnray31
0
187
Member Avatar for daviddoria

I have a program with about 20 forms, almost all of which use the data from a tables in a dataset (from a datasource I added to the project). So I have made a global variable in a module: [code] Public TTData As New TTDataSet [/code] And a DataAdapter for …

0
50
Member Avatar for bojomojo

I believe this is generally called tokenizing? Take a look at this - [url]http://www.daniweb.com/forums/thread27905.html[/url] Is that what you were asking?

Member Avatar for ArkM
0
202
Member Avatar for daviddoria

I have a typed datatable that I am viewing part of with a datagridview [code] dgvData.DataSource = TTData.PunchEventTable.Select(FilterString, SortString) [/code] My question is how do I delete the row that is selected in the DataGridView from the database? If I use [code] TTData.PunchEventTable.Rows.RemoveAt(dgvData.SelectedRows(0).Index) [/code] I believe it will delete the …

0
50
Member Avatar for colmcy1

I don't understand the relationship between truck_data and position_axle Maybe give a sample input/output?

Member Avatar for colmcy1
0
98
Member Avatar for phillipdaw

I always pass things as const if the function will not change them. Also you should pass anything bigger than a single int or double by reference. Both techniques are shown here: [code] int compare(const string &target, const string &s)//outputs # of correct characters { int alike = 0; for …

Member Avatar for siddhant3s
0
104
Member Avatar for Fouly

I've never done this, but it doesn't look you passed any arguments? What about [code] system("FileName.exe arg1 arg2"); [/code]

Member Avatar for siddhant3s
0
681
Member Avatar for arpitha_ks

Use vectors! [code] #include <vector> int a,b; cin>>a>>b; vector<int> InnerVector(a, 0); vector<vector<int> > OuterVector(b, InnerVector); [/code]

Member Avatar for siddhant3s
0
87
Member Avatar for daviddoria

I want to do something like this [code] template <class T> vector<T> DereferenceVector(vector<T*> &PointerVec) { vector<T> ObjectVec; for(unsigned int i = 0; i < PointerVec.size(); i++) ObjectVec.push_back(*PointerVec[i]); return ObjectVec; } [/code] and call it with [code] void TestDereferenceVector() { vector<double*> a(10); vector<double> b = DereferenceVector(a); } [/code] That seems to …

Member Avatar for daviddoria
0
107
Member Avatar for thingstealer

Yea, I'd guess 'size' is either a "reserved word" (not technically?) - just try to rename the variable and see if that works.

Member Avatar for thingstealer
0
147
Member Avatar for guest7

Why not try the easy way to read files? [code] ifstream fin(Filename.c_str()); if(fin == NULL) cout << "Cannot open file." << endl; vector<string> Lines; string line; while(getline(fin, line)) { Lines.push_back(line); } cout << "NumLines: " << Lines.size() << endl; for(unsigned int i = 0; i < Lines.size(); i++) cout << …

Member Avatar for daviddoria
1
129
Member Avatar for rastaberry
Member Avatar for rastaberry
0
109
Member Avatar for akn
Member Avatar for Ancient Dragon
0
152
Member Avatar for cppStudent

Why would you ever use a pointer to a pointer? Seems like its just asking for problems?

Member Avatar for Salem
0
89
Member Avatar for alphabetanm

It may be because you have a semicolon at the end of this line: [code] while(mod_number2 = i%1); [/code] Try removing that. Also, please use [ CODE ] tags around your code - what you posted was very difficult to read. Dave

Member Avatar for alphabetanm
0
99
Member Avatar for odzky

That is like saying ok I want to talk to this guy in French... I know he is French... now what do I do?

Member Avatar for Ancient Dragon
0
278
Member Avatar for skitzo315

You will need to use the c_str() function of the string because a lot of these function accept an array of characters, not an actual string. [code] #include <string> using namespace std; string filename = "whatever.txt"; fstream fio(filename.c_str(), ios::in | ios::out | ios::binary | ios::trunc); [/code] Dave

Member Avatar for siddhant3s
0
314
Member Avatar for atman

I rarely need to use it. If you are within the scope of the class, MyVariable is the same as this->MyVariable. It is sometimes just nice for other people that read your code so that they know where these variables reside. Dave

Member Avatar for siddhant3s
0
143
Member Avatar for jaison.steephen

I use openGL with SDL ([url]http://www.libsdl.org/)[/url]. Be careful, there is quite a learning curve!

Member Avatar for daviddoria
0
50
Member Avatar for daviddoria

If I do this, I get "warning: address of local variable returned". [code] unsigned char* CharArray(void) const { unsigned char arr[3]; arr[0] = R_; arr[1] = G_; arr[2] = B_; return arr; } [/code] So the reason for that is that the memory allocated for arr[] is only available within …

Member Avatar for ArkM
0
86
Member Avatar for waferstix
Member Avatar for ScienceNerd

This is called casting. The c++ style way to cast is [code] total_gal_paint = static_cast<int> ( (total_area / coverage_gallon_paint) + (0.9999) ); [/code] The code DemonGal711 posted is exactly the same thing as far as I know, its just a little "c style" :) Also, it would be much easier …

Member Avatar for daviddoria
0
121
Member Avatar for WesFox13

You should post only problematic section of the code, not the entire file! [code] getline(istream& fin, string& num_of_isbn, char '\n'); [/code] You need declare these variables and then pass them to the function, ie [code] istream fin; string num_of_isbn; char a; getline(fin, num_of_isbn, a); [/code] The & will be in …

Member Avatar for daviddoria
0
85
Member Avatar for nishidh

I would search for boostnb.h or boostnb.cpp, because boostnb.o won't be made until you compile boostnb.cpp into the .o ! Also, please use code tags for only the code!

Member Avatar for daviddoria
0
161
Member Avatar for rekhamanoj

That is a linking error. You need to either link to the library, ie [code] g++ yourfile.cpp -l lTheLibrary [/code] or actually compile the source along with yours (if you have it) [code] g++ yourfile.cpp TheFileTheFunctionIsIn.cpp [/code] Unfortunately, this sounds like a big set of libraries and they are usually …

Member Avatar for daviddoria
0
129
Member Avatar for hurbano

You may want to simplify the question to a single case. Once you get an answer you should be able to apply it to the rest of the cases. It just is overwhelming to people reading to look at 1000 lines of code that you post. Also, please wrap the …

Member Avatar for VernonDozier
0
441
Member Avatar for daviddoria

A friend convinced me to store a vector of pointers in my class: [code] vector<Point*> Points; [/code] In my class instead of a vector of "real" objects (what do you call this?). The problem now is that there are several functions (out of my control ie. in a library) that …

Member Avatar for Narue
0
115
Member Avatar for daviddoria

I have a function that I call recursively, but I want to keep track of a maximum through the entire process. This is what I am doing: [code] void Intersect(double &MaxDistance) { if(something) MaxDistance = something; Intersect(MaxDistance); } [/code] Is that correct/reasonable? Something doesn't seem to be working and I'm …

Member Avatar for vmanes
0
158
Member Avatar for daviddoria

There was another thread about this ([url]http://www.daniweb.com/forums/thread114737.html[/url]) but it didn't seem to be resolved? If I have a vector of int's and another vector of the same length of corresponding names, I would like to sort the ints and have the names "follow" [code] vector<string> Doubles; Doubles.push_back("Name1"); Doubles.push_back("Name2"); Doubles.push_back("Name3"); vector<int> …

Member Avatar for kbshibukumar
0
134
Member Avatar for soroushc

You should simplify the problem. This problem has nothing to do with a bank, so why mention a bank? Ask something like [quote] I want to input a line like "MyName 2.3 4.5 6.7" and store the input in a string and 3 doubles. How do I do that? [/quote] …

Member Avatar for Stefano Mtangoo
0
167
Member Avatar for daviddoria

[code] double P = 3.5/(.1 * sqrt(2.0*3.14159)) * exp(-pow(5.0,2) / (2.0*pow(.1,2))); cout << P << endl; if (P==0) cout << "P is zero!" << endl; [/code] Is this underflowing so it is getting rounded to zero? The problem is that I am taking the log of this, so if it …

Member Avatar for Rashakil Fol
0
115
Member Avatar for daviddoria

I wrote a pause function: [code] void Pause(void) { printf("Paused...\n\n"); fgetc(stdin); } [/code] It generally works fine (hit enter to continue). But one program doesn't seem to want to stop at all... [code] if(P == 0) { cout << "P=0!" << endl; //just as another attempt to stop it , …

Member Avatar for Nick Evan
0
150
Member Avatar for daviddoria

Is there anyway to get the calling function? ie [code] void A() { if (A() was called from B() ) do something; else do something else } [/code] Is this possible? Dave

Member Avatar for Rashakil Fol
0
132
Member Avatar for daviddoria

In integration.h I have this [code] class FunctionClass { public: virtual double f(const double x) = 0; }; [/code] Then in probability.h, I have this [code] #include "integration.h" class Mass1 : public FunctionClass { public: double Clutter; Mass1(double c) : Clutter(c) {} double f(const double x) { return Clutter * …

Member Avatar for _adam_
0
1K
Member Avatar for daviddoria

I just learned about returning a reference... and it seems to me that I can delete my mutators now? ie. [code] class foo { int A; //mutator void set_A(const int a) {A=a;} //accessor int get_A() {return A;} } int main() { foo MyFoo; int b = MyFoo.get_A(); //get MyFoo.set_A(4); //set …

Member Avatar for daviddoria
0
214
Member Avatar for daviddoria

I would expect this to ouput the 5 doubles, but instead I get the output below. [code] vector<double> a(5); a.push_back(1.2); a.push_back(1.3); a.push_back(1.4); a.push_back(1.5); a.push_back(1.6); vector<double>::iterator i; i = a.begin(); while( i != a.end() ) { cout << *i << endl; i++; } [/code] [code] 0 0 0 0 0 1.2 …

Member Avatar for daviddoria
0
77
Member Avatar for daviddoria

Anyone know a good, simple set of classes to do thing like cartesian to spherical conversion, coordinate system transformations, etc? I wrote some of this stuff, but my code keeps breaking because of "special cases" that I have not handled. I just want to be able to use this stuff …

Member Avatar for StuXYZ
0
201
Member Avatar for daviddoria

I put together this little example to test my sanity, and it failed! [code] #include <iostream> #include <fstream> #include <vector> #include <string> #include <sstream> using namespace std; /* Example.txt 23 test 4.5 */ int main(int argc, char *argv[]) { string Filename = argv[1]; cout << "Filename: " << Filename << …

Member Avatar for Freaky_Chris
0
780
Member Avatar for daviddoria

Anyone see a problem with this line? My Color header is included (I use it all the time). map and vector are included. [code] void GenerateColors(map<Color<unsigned char>, int> &Map, vector<Color<unsigned char> > &List, int num) [/code] I don't see anything wrong? Dave

Member Avatar for StuXYZ
0
158
Member Avatar for daviddoria

This problem comes up quite a bit for me. I'll have a project that I work on for a couple months (the point is that it is a large project with multiple classes, etc). As an example, say I made a program that draws a square. So I have this …

Member Avatar for daviddoria
0
100
Member Avatar for altrim
Member Avatar for jimbob90

1) make sure you open the file in append mode in the add() function (i'm not sure what the default mode is) 2)there is no need to do [code] while (!a.eof()){ getline(cin, line); [/code] you can simply do [code] while(getline(cin,line)) [/code] If you don't tell us what's wrong, we can …

Member Avatar for deepglue555
0
183
Member Avatar for shamila08

There's a really easy to use timer in VUL (part of VXL). It may be a bit of overhead to install it, but it works great once it's installed. Dave

Member Avatar for shamila08
0
153
Member Avatar for david7

Is there a way to remove these threads altogether? It really pollutes the forums. Dave

Member Avatar for Freaky_Chris
0
271
Member Avatar for monkey_king

Debug symbols are needed if you are trying to debug though! If by profiling you mean something like cachegrind, that will be VERY slow... (maybe 50x slower?), but you get an unbelievable view of any bottlenecks in your code. Dave

Member Avatar for daviddoria
0
89
Member Avatar for monere

You may look into some kind of library for working with videos. I think VXL ([url]http://vxl.sourceforge.net/[/url]) has a VIDL library for working with videos. VTK also can do things with videos ([url]http://www.vtk.org/doc/nightly/html/classvtkFFMPEGWriter.html[/url]) Good luck! Dave

Member Avatar for skatamatic
0
103
Member Avatar for Phil++

Is this being done with some external program? I wasn't aware c++ could upload files... lol

Member Avatar for Murtan
0
301
Member Avatar for hongpuay

Please wrap your code in code tags. I think you have to explicitly define an update command for the data adapter.

Member Avatar for daviddoria
0
98
Member Avatar for Aigini
Member Avatar for Ramy Mahrous
0
97

The End.