Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
  • No support for DVD drives lacking firmware region coding

That's funny because DVD works in my machine.

  • New monitor needed to view Hi-Definition content

And why is that Vista's fault? My old anolog tv doesn't work with hi-def either, so is that the fault of the local tv stations?

  • Vista will encrypt hard drives by Default

Not a problem -- just turn that feature off.

  • Vista won't work with many graphics cards and will remove games developers' ability to cater for older systems

That was a problem with Vista when it first came out too. So nothing new there.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you almost have it. PathAppend() is not needed in your example.

void EnumerateFolderFS(LPCTSTR path)
{
   TCHAR searchPath[MAX_PATH];

   // a wildcard needs to be added to the end of the path, e.g. "C:\*"
   lstrcpy(searchPath, _T("C:\\*.h"));
   //PathAppend(searchPath, _T("*")); // defined in shell lightweight API (v4.71)

>>2. MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
You created a console program but coded a windows GUI program using WinMain().

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>strcpy(searchPath, L"c:\\*.h");
That doesn't work because strcpy() requires char*, not wchar_t* Instead use _tcscpy() _tcscpy(searchPath, _T("c:\\*.h")); Note that _tcscpy() is a macro defined in tchar.h which translates to either strcpy() when UNICODE is undefined or wcscpy() for UNICODE.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>This is the code i get some where online. Why i get an error message stating that " error C3861: '_T': identifier not found"?

You have to include tchar.h

>>2. and where actually i should place the wildcard for me to search files of certain type (for exp: .h)?

In the FindFirst() function call. Unless you want UNICODE support I'd replace TCHAR and _T macros to make the code more readable.

char searchPath[MAX_PATH];
strcpy(searchPath, "c:\\*.h");
...
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

TCHAR is defined in tchar.h. LPTSTR and LPCTSTR as well as a lot of others are defined in windows.h

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Are you using *nix or MS-Windows ? If MS-Windows you can use FindFirstFile() and FindNextFile() to get the file names. See examples on MSDN and here at DaniWeb.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I'm new to C++ (long time java user though), and still not quite sure when I should and shouldn't use pointers. I'm going to go back and make the change you suggested.

Rule-of-thumb: never use pointers unless absolutely required. In your class, pointers are not needed.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
colHeadVector = new std::vector<QLabel*>(); //line 342
	rowHeadVector = new std::vector<QLabel*>(); //line 343
	widgetVector = new std::vector<std::vector<QWidget*>* >();  //line 344
	arrayGrid = new QGridLayout(); //line 345

Why are those pointers? Just declare those vectors without pointers. You are not saving anything by making them pointers, instead you are creating a lot of headaches for yourself.

std::vector<QLabel*>  colHeadVector;
std::vector<QLabel*>  rowHeadVector;
std::vector< std::vector<QWidget*> >  widgetVector;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I suspect the problem is actually somewhere else. Will you post the code that calls SetScheme() -- hopefully attach the rest of the problem so that I can compile and run it, assuming this is for MS-Windows operating system. Instead of attaching the files one at a time just use WinZip and zip them all then attach the *.zip file (remove object files and other compiler-generated files).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do you mean this function?

void Weather::SetScheme(SceneArg *sceneArg)
{
	memcpy(&mScheme,sceneArg,sizeof(SceneArg));
	mIsLoaded = true;
	_update();
}

The only problem I see in that function is that sceneArg should be declared const. Also check that it is a valid pointer.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

try this example DLL: I compiled it but didn't test it

#include <windows.h>
#include <stdio.h>

static DWORD WINAPI myThreadProc(void* parmeter)
{
   while(true)
   {
      printf("Hello world!!!\n");
      Sleep(1000);
      }
   return 0;
}
   
__declspec( dllexport )  int WINAPI HelloWorld()
{
   CreateThread(0, 0, myThreadProc, 0, 0, 0);
   return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here is a simple example. You need to overload the [] operator, as below.

const int MAXSIZE = 20;
class MyClass
{
public:
    MyClass() 
    { 
        x = 0; 
        for(int i = 0; i < MAXSIZE; ++i)
            array[i] = i+1;
    }
    int& operator[](int n) {return array[n];}
private:
    int x;
    int array[MAXSIZE];
};


int main()
{
    MyClass mc;
    int n = mc[4];
    cout << n << "\n";
    mc[4] = mc[4] * 100;
    n = mc[4];
    cout << n << "\n";

}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>for(numStudents; numStudents > 0; numStudents -= 1)

Or just simple this: for( ; numStudents > 0; numStudents -= 1) >>So basically whether you are declaring a variable or not, you must always have the semicolon? then the condition and then the counter(s) ?

Yes, there must always be two semicolons. As a minimum like this: for( ;; ) which is the same as this: while(true)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The for statement is actually explained on page 97. paragraph 6.5.3.3 shows the correct syntax. Without doing any research I'll bet there has been a later correction to 6.5.3.1 and what was shown at the botton of page 95.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Now that you have posted your homework assignments, what are you asking from us ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

stargs.h contains the functions. Example here.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There are going to be many porting issues. Just take them one at a time. For example, iostream.h is depricated (obsolete). use <iostream> (without .h extension) instead.

>> skipped when looking for precompiled header use
The first line in *.cpp files with that compiler needs to be #include "stdafx.h" because that is for precompiled headers. Several compilers use precompiled headers, and Microsoft compilers typically using stdafx.h, although you can change the name of that file if you want to. You can also turn off precompiled headers.

>> fatal error C1083: Cannot open include file: 'intro_sht.cpp':
That error should be obvious to you. The error message of quite explicit.

>>At this point I think I need some location sources to read. Any recommendations?
I don't know what kind of documentation you are looking for. Instructions on how to use the compiler? Or what ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 3 does not allocate any memory for that array and sprintf() doesn't allocate it either.

void cabext(const char *fname)
{
	char command[1024] = {0};
	sprintf(command,"cabextract -L -d /tmp/ %s",fname);
	system(command);
}
Salem commented: Yes indeed. +17
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

IMO you should not try to integrate the gui into that old DOS code, but rather to write a whole new GUI that includes the features of the old code. First create the gui windows and dialog boxes the way you want them. After you finish that you will probably realize how you can integrate the non-visual features on the DOS program into this new program.

And stop using VC++ 6.0 -- its too old now. Download the free VC++ 2008 Express because its a lot better c++ compiler.

Another alternative is to learn and use C# because its easier to create GUI with C# than it is with C++.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 163 prevents you from making it a pure virtual function. You can't create an object of a class that has a pure virtual function, as you have already found out. So my previous idea to make it pure virtual won't work.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 105 needs the class soping in the name. You can not have just one function for all three classes -- you have to code one method for each class. Three classes, each class declared printtostream() so you must code each of the three methods, one for each class.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

We are just guessing now. Post the code so that we can test see exactly what you have done (you can attach the *.cpp and *.h file(s) to your post)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

In the base class the function should be declared a pure virtual function virtual void printtostream(ostream& out) = 0; This will force one (or more) of the derived classes to provide the implementation for that function.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Then you did it wrong. Post your code how you tried it. strand( time(0) ); should appear only once in your program, preferably near the top of main() before any loops or other executable code.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The solution is to find out what is the difference between clicking on the first column and clicking on the second column. In both cases I think your program should get the click event.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

two problems:
1) ReaderThread must be a static method of the class

2) remove the & &MultiReader::ReaderThread, . Like arrays all you need is the name of the method.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>> but i would like to know if you could recommned me a site which has a list of all the commnads that I could use

The only site I know of is www.microsoft.com. Just type the name of the function in its search engine and it will locate the explaination in MSDN.

>>but I still have a long way to go to understanding it all.
Don't feel too bad because there is a huge learning curve to know it well -- give yourself 6 months to a year, depending on how fast you learn.

Keep in mind that win32 api is written in C, not c++. There are c++ classes available, such as MFC and wxwindows.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

sorry, there is no s on the end #include <algorithm>

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

So you have a vector that looks like this ? vector< vector<string> > lst;

vector< vector<string> > lst;
    vector<string> a;
    a.push_back("hello");
    a.push_back("world");
    lst.push_back(a);
    for(size_t i = 0; i < a.size(); i++)
    {
        vector<string>& a = lst[i];
        for(size_t j = 0; j < a.size(); j++)
            transform(a[j].begin(), a[j].end(), a[j].begin(), toupper);
    }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you can use the transform function from <algorithms> header file

vector<string> lst;
for(int i = 0; i < lst.size(); ++i)
{
    transform(lst[i].begin(), lst[i].end(), lst[i].begin(), toupper);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

First call GetSelectedCount() to get the number of selected items, then in a loop call GetNextItem() to get the index value of each selected row. See example here.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I can't help you with your problem, but you don't need that while loop f_in.read(speech, 10000 * sizeof(short)); But of course there is no guarentee that sizeof(short) will be 2. It might be on your system but if you intend to port that porgram to another os then the size may be something else.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I think I know what you want -- if I'm in the second room, save, quit, then resume the program should resume on the second room. Right?? If yes, then I think you need to save another piece of info in save.txt -- what room number the game is in.

Then in mainMenu()

case 'c':
        case 'C':
               continueGame(); // goes to void continue
               if(CurrentRoom == 2)
               {
                   roomtwo[m][n] = guy;
                   newRoom();
                   room2();
               }
//               else if(CurrentRoom == 3)
//                   room3();
            
            menuLoop = 0;
            break;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Attached is the revised code that works. It only generates one file named save.txt. You should consolidate all those instance of using ofstream because in my code they all do the same thing.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Triangle tri (3,4); //looks like a drifting object
That is not a reference. Its just simply instantiating a Triangle object and passing the two parameters to the constructor. No references involved here.

If that's true, can I do something like--

Point myPoints[3] (2, 2);

or maybe

Point myPoints[3] = (2, 2);
--where all of the points are initialized to be (2, 2)?

Unfortunately you can't to that.


>>One last thing! When would I ever use a reference to a pointer? i.e...
When you want a function to allocate memory for the calling function's pointer

int foo((int *&p)
{
    p = new int[255];
    for(int i = 0; i < 255; i++)
       p[i] = i;
}

int main()
{
    int* p = 0; // a null pointer
    foo(p);
    for(int i = 0; i < 255; i++)
       p[i] = i;
}

The above can also be done with pointers, but references is a lot cleaner and less complicated

#include <iostream>
#include <ctime>
using std::cout;

void foo(int **p, int n)
{
    *p = new int[n];
    for(int i = 0; i < n; i++)
    {
        (*p)[i] = rand();
    }
}

int main()
{
    int* p = 0; // a null pointer
    int n = 25;
    srand((unsigned int) time(0) );
    foo(&p, n);
    for(int i = 0; i < n; i++)
       cout << p[i] << "\n";
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Why use the stack of the space is so limited?
What makes you think stack space is so limited ? In MS-DOS 6.x and earlier and in some embedded systems that is true, but if you are using *nix or MS-Windows 32-bit compilers stack space isn't really anything to be too concerned about unless you have an object that used several megs of space.


>>What are the advantages to using the stack over the heap?
As I mentioned in your other thread, using pointers unnecessarily can be dangerous to your program. Coders (me too) have spent days trying to find a bug with pointers. Such bugs are often very difficult to find.

>>Is it really so bad to use pointers vs "reference variables?"
No -- but as you found out you have to be very very careful. You can introduce all sorts of memory leaks and bad pointers when you use a lot of pointers. You can easily avoid all those nasty problems by using references.

>>What exactly is the life of a stack object?
The life of a stack object is the life of the function in which the object is declared. All objects are destroyed as part of the function exit code. Memory dynamically allocated to pointers are not auto destroyed, you have to explicitly use the delete operator if new was used to allocate the memory. So if the function returns without deleting the pointer then a memory …

William Hemsworth commented: Better than my answer :p +2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

suggestion: change the color of the help menu because it can't be read. Dark blue on black background is nearly impossible to read.

Why don't you just save the coordinates for all rooms then read all of them.

ifstream continueData;
continueData.open("save.txt");
continueData >> playerName >> life >> x >> y >> m >> n;
continueData.close();

<snip>
             ofstream saveGame;
             saveGame.open("save.txt");
             saveGame << playerName << " " << life << " " << x << " " << y;
             saveGame << m << " " << n << endl;
             saveGame.close();
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

And remember that most professionals didn't go to school to learn to program, they taught themselves or were taught on the job.

That was my case too. I didn't start learning until later in my life, over 40. I bought a cheap C compiler, a book, and started studying. Then I got an entry-level temp job at Account Temps and my career took off from there.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>To tell you the truth I was purposely trying to use pointers since they're very adjacent to Java's reference variables
I think you misunderstood the relationship. From what I understand Java doesn't have the concept of a pointer like what is in c++ pointers. The reference variables in Java are equivilant to the referneces in C++, not pointers. See line 45 of the code I posted.

>>I didn't realize they could cause so many problems!
Yup -- try to avoid pointers when ever possible.

>>I expected it to be more efficient to use a structure
No. In C++ structures are nearly identical to classes. There is no efficiency difference between the two.


>>I didn't think I was using too much space honestly.
It wasn't the space but the complexity of pointers. You just simply made your program too complex with all those pointers. And I didn't test all the pointers but it is pretty easy to use uninitialized pointers or pointers with NULL values. And either of those conditions will cause the program to scribble all over memory.

The fewer pointers you use the fewer bugs you have to debug.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The binary flag prevents streams from interpreting any of the binary characters (whose character values outside the range of normal printable characters). In normal text files the "\r\n" characters (ms-windows) in the file are used to indicate end-of-line for functions such as getline(). Binary files may also by coincidence have the "\r\n" pair, so the binary flag is used to prevent any interpretion by fstream.

>>and other flags like ios::app are used instead
You can use both flags at the same time by using the or operator | to combine them ofstream out("test.data", ios::binary | ios::app);

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The problem(s) appear to be the use of all those pointers. Get rid of all the pointers and you get rid of the errors. Here's the revised program without pointers. This implementation also deleted the destructors, new and delete operators.

#include <cstdlib>
#include <iostream>
#include <math.h>

/**
File test_!.cpp in Project testing_Something.dev

Progress of project: Unexpected System exit after a certain amount of time, but no errors.
Suspecting the stack ran out of room to store variables for vector-magnitude comparisons via
the overloaded operator ==.

So far tests show that this project was successful, but I'm still trying to find the error.
*/

using namespace std;

class Point;
class Triangle;
class P2DVector;

class Point{     
      private:
             double xP;
             double yP;
             
      public:
             Point(double x, double y){
                   xP = x;
                   yP = y;
             };
             Point() {xP = 0; yP = 0;}
             void Set(double x,double y) {xP = x; yP = y;}
             double getX(){return xP;};
             double getY(){return yP;};
             void showCoord(){
                  cout << getX() << ", " << getY() << endl;
             };
};

class P2DVector{
      private:
             Point points[2]; 
      
      public:
             P2DVector(Point& first, Point& second){
                      points[0] = first;
                      points[1] = second;        
             };
             P2DVector() {points[0] = Point(0,0); points[1] = Point(0,0); }
             void Set(Point& first, Point& second){
                      points[0] = first;
                      points[1] = second;        
             };
             //~P2DVector(){for(int i = 0; i < 2; i++){ if(points[i] != 0){delete points[i]; points[i] = 0;}}}; 
             static double power(double value, int exponent){
                    if(exponent < 0)
                    {
                        cout << "Negative powers currently unsupported.";
                        cout << "\nRetrying with positive value." << endl;
                        return power(value, -exponent);
                    }
                    else …
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need to close the output file before opening the input file because some of the data has not been flushed to disk yet.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Since displayMessage() is not a member of Salary class the compiler is looking for a function names getSalary() that is also not a member of that class.

One way to fix this is to make displayMessage a member of the class Salary::displayMessage()

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

.
oh and once the god come back,all the psychich on the earth will lose their powers but its for the greater good.=]

He's several years too late because all the psychics on tv have already been exposed as frauds. That's why we don't see them on tv anymore.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

So I'm still having a ton of issues with my functions that pass by reference. The compiler is giving me numerous errors with both the call and the function itself.
Here is the simplest function that passes by reference:
Does anyone have some ideas what's wrong?

Yes --
1) pBoard is not a 2d array but a single dimension array.
2) you declared pBoard as a const, that means you can not change any of its values.

void Display(int Board[2][3])
{
     for (int row = 0; row <= 8; row++)
     {
          cout << endl;
          for (int column = 0; column <= 8; column++)
          {
              cout << Board[column][row];  // prints horizontally. 
          }
     }
}

int main()
{
    int Board[2][3];
    Display(Board);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
reset(int (&Board)[2][3])

I have never in over 20 years seen anyone code a function prototype like that. Arrays are ALWAYS passed by reference, it is not possible to pass an array by value. So this is all that is needed void reset(int Board[2][3]);

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Instead of just begging someone to write your program for you why don't you try to do it and post what you have done, then ask specific questions about that you don't understand.

And stop posting the same question over and over and over and over ...

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Sorry, I can't help you because I don't know the first thing about that language. That would be pretty easy to write in other languages such as C, C++ or VB.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What language is this? Your post looks like homework.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I am not an expert but i am trying to learn .

I dont understand something in the program.

&rea 's code

unsigned int* RegionToArray(System::Drawing::Bitmap^ binaryImage,unsigned int coordinate_x, unsigned int coordinate_y, unsigned int width_rect, unsigned int height_rect){
coordinate_x=this->coordinate_x;
coordinate_y=this->coordinate_y;
width_rect=this->width_rect;
height_rect=this->height_rect;

Well If the function is a class member i dont understand why &rea used all the variables as Arguements when they can be accessed using this ->

The function parameters coordinate_x, coordinate_y. width_rect, and height_rect are not class members but are passed into the function by somethig else, which was not posted. The statement you quoted is just copying them into the class variables.