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

Please vote for your favorite avatar -- Too bad polls can't include graphics. I would have like to add more names, but max of 10 allowed, so if your favorite is not listed here just check Other and post the name you want.

And you can vote for more than one, but don't vote for your own.

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

I don't know what your question is, or even if you have one. But this line is wrong:
>>#include <iostream.h>


Current c++ standards do not use the .h extension. So if you use a modern compiler than code it like this: #include <iostream>

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

try this: There is no reason to declare the function returning double when it only returns an integer.

int getData()
{
       ifstream inFile;
       
       inFile.open ("c:\\Ch9_Ex9Data");
            
       if (!inFile)
       {
             cout << "Unable to open input file!"<<endl;
             return 1;
             } 
       
       inFile >> high >> low;
       return 0;
       }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This is not proper ANSI C

You mean the pseudocode he posted? If not, what parts do you think are not ansi c?

>>int entity::loadObj(const char *loc,\

Ok, I think I get it now -- that line (line #1) is c++, not c.

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

>>I'm parsing this WaveFront .obj file
WaveFront .obj is NOT a text file so it doesn't contain lines, all it contains is a bunch of binary data. You can't treat binary files as if they are text files.


line 1 thru 3: remove the trailing \ character -- c language does not support line continuation characters. Maybe its just a posting error here???

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

Secondly, you do not need to pass the file stream through a function. if it has already been declared in main then you just have to use it the same way you use your cin statements.

If the stream is declared in main(), how do you expect to use it in another function if you don't pass it to that function? The stream has to be passed BY REFERENCE to other functions. cin doesn't have to be passed because its declared globally.

getData() must be declared like this: see RED double getData(ifstream& inputF, double high, double low) BUT, BUT the way the op posted it last is the better way to do that -- declare the stream object inside the function that will use it.

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

If running MS-Windows check Task Manager to see CPU time in use -- if its approaching 90% then you have too many threads.

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

>>How can I get daily classes for C?
At your local university, but if you didn't know the answer to that question then I question your ability to become a programmer!

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

You can start out by learning to read -- many of the other threads here discuss the same question.

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

you could have subclass3 be derived from both subclass1 and subclass2

class subclass3 : public subclass1, subclass2
{
   // blabla
};
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you are going to plagerize something you would at least post the link where you stole it.

http://www.funny2.com/mensrules.htm

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

Dev-CPP is a good IDE, for beginners anyway, but its lacking a good debugger. VC++ 2005/8 is the most superior ide/compiler/debugger I've ever seen. I have not used Code::Blocks but if its debugger is anything like that of Dev-CPP then it really sucks.

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

IMO charge rate + expenses (travel/lodge/food)

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

Instead of Sleep() you can use WaitForSingleObjectEx(), which lets you abort the sleep early.

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

line 10: that is a function prototype and should appear outside any function, such as on line 6.

And the parameters in the function prototype on line 10 doesn't match the parameters in the actual function on line 35. The two must match exactly.

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

so what compile errors are you getting now? And why don't you just fix them ?

line 246: you can't return two things at the same time. The comma operator will cause only the last one to be returned, ignoring the first one.

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

I never had problems with that? Do you mean that some functions have become deprecated, because those warnings are quite easy to solve.
If not: could you post an example if it's not to far off-topic; I'm interested

Here is an example that I encountered. This VC++ 6.0 code snippet will not compile because its non-standard

for(int i = 0; i < 5; i++)
   // do something

if( i == 5)   // <<<< error here because i is undefined but ok in vc++ 6.0
{
   // blabla
}

And if the program uses MFC there have been several MFC changes that might need to be modified (such as CString was changed from a c++ class to a template, which might cause proglems in some programs).

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

get the source code for vangrind and compile it yourself with a windows compiler ??? I don't know how difficult that might be.

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

>> for (i=0; i<=rows; i++)

I hope you realize that is going to cause data overflow errors which might possibly crash your program or destroy other parts of your program if that code is incorporated into a larger program. Why? Because the loop performs one too many iterations -- if the value of rows is 25 then the above loop will count from 0 to 26, which is one too many. Same with the inner j loop.

What you want is this: for (i=0; i < rows; i++) Then there is the danger that the data file doesn't contain that many numbers (rows * columns).

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

I will agree that resource.h might contain some crap that the resource compiler doesn't understand. Only the op can know that, and he has posted nothing about it. The *.h file could be just missing the // for start of comment. But since we're just guessing, there is no point discussing this any more.

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

try clearing the string yourself before calling getline() and see if you still get the same results. I suspect it won't make any difference. That means the problem is something else in your program, such as something writing beyond the bounds of an array. If your program is still using that setToolName() function you posted earlier then that's the problem -- its not null-terminating the string. strncpy() doesn't null-terminate the string if the source string is longer than the destination buffer.

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

Dev-C++ is not a compiler -- its an IDE that calls other programs to compile the files. And there should be no semicolons in resource.h

Alex Edwards commented: Totally approved/agreed! +2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I used VC++ 2008 Express and had a couple errors. There are two functions that are supposed to return values but don't. You have to correct that problem before attempting to run the program.

error C4716: 'getWeaponSelection' : must return a value
error C4716: 'fileHighScore' : must return a value

And you need to include <string> at the top of the program.

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

IMG tags don't work here. Hit the Advanced button, scroll down, then select the Manage Attachments. That will let you load an image file to your post.

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

How about this one? But this has the danget of writing outside the bounds of the array, so you need to add more checkiing.

rows = cols = 0;
while( infile >> numbers[rows][cols])
{
    cols++;
    if(cols > 7)
    {
        cols = 0;
        rows++;
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

google is a wonderful invention :)

A constructor cannot be virtual because at the time when the constructor is invoked the virtual table would not be available in the memory. Hence we cannot have a virtual constructor.

http://www.codersource.net/published/view/325/virtual_functions_in.aspx

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

>>fflush(stdin);
Nonstandard. fflush() is only for use with output streams. Some compilers has added support for input streams, but such implementations are non standard. Read this and this too

>>No I cannot do this because then even record can have its own size and it will not be consistent to print the records and align them.
Huh? But what I posted was just what you were trying to do. All I did was delete the need to calculate the length -- strnlen() will do that.

>>My code is the following but it does not work because apparently getline only works with arrays?
There are two forms of getline: one for std::string and the other for character arrays.

std::string name;
getline(cin, name);

or
char name[20];
cin.getline(name, sizeof(name));

>>If I stay to the following code then I have the issue where it keeps previous input and tags it on to the end of the array
If you are experience that problem then there is something else wrong because getline() doesn't work that way.

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

you are doing too much work!

int main()
{
    char name[10] = {0};

   strncpy(name,"How Now Brown Cow", sizeof(name));
   name[sizeof(name)-1] = 0;
   cout << name << "\n";

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

Welcome to DaniWeb, hope you enjoy your stay. The first computer I ever saw was in a SAGE building in McChord AFB, Tachoma WA in 1963 -- one computer occupied three stories of that building. But I'm sure you know about those monsters :) I wasn't into computers in those days, but had to walk past it to get to my job.

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

>>I am not sure how to prevent the padded characters within a string array from printing.

Post an example of such a string -- something like this perhaps:

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

I'm not sure what language that is, but its not C or C++, unless the contents of "resource.h" happen to be an extremely nasty set of macros and #define statements.

If we knew what was inside resource.h. we might be able to give a better answer

That is a resource file that defines MS-Window GUI resources such as menu, dialog boxes, etc. resource.h just contains define's for integers that are used in the resource file and elsewhere in the c++ code. Resource files are compiled with resource compilers, not c++ compilers.

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

c++ compilers don't know how to compile resource files. Use a resource compiler for that.

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

no

Does 1 + 1 equal 2 ? :D

My HS math teacher said she could prove it doesn't (and this was in 1958), but I never understood why. Something to do with calculus.


Is Mt. Everest getting taller ?

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

how is chRead declared? What do you expect it to contain? an unsigned char can only hold the integer values between 0 and 255, or the hex values between 0 and 0xff. decimal values can be easily converted to hex.

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

That pointer is used to create a linked list of structures -- each pointer points to another structure in the list. Study linked lists and you will find out how all that works. There are many tutorials available, such as this one.

tzushky commented: Great tutorial...Thanks +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>cin >> setw( 20 ) >> toolName;
setw() is only for output streams, it does nothing on input streams such as cin.

1) You didn't post the rest of the code so no way to answer that question. My guess is that you may need to clear the '\n' from the input keyboard buffer, which is frequently left there when entering integers. See this thread for how to do that.

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

I kinda want to do it my self , no DirectX. I want some help like a piece of code to explain, something more explicit than the Wikipedia article.

Download the source code for OpenGL and you will find the code you want. Otherwise that wiki article looks like it explains things pretty thoroughly. Doing what you want is a bit more difficult than writing a Hello World program, so expect it to be pretty complicated. Also look at some of the links given at the bottom of that article.

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

you can't have the same function name in two or more *.cpp files and link them together.

>>what should I do pls.
Name one of the functions something else.

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

http://directorblue.blogspot.com/2008/07/ten-questions-barack-obama-will-never.html

The simple explaination for the questions posed above --- the terrorists were Afghanistan, not Iraq before Bush invaded Iraq and deposed its leader.

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

Oh, you mean like this? Here are some more links that might help you.

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

Isn't it named TTreeView or something like that? Then just google for it and you should find the information you need about how to use it.

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

how to make windows themes


>>does winapi have a future? i mean is it possible to make entire
Yes, and yes.

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

"Never trust a computer you can't throw out of a window" -- Apple cofounder Steve Wozniak as published in The Reader's Digest, August 2008, p. 119.

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

>>3. Better use tabs \t to adjust columns in all trailing printfs.
That can easily screw up the spacing. Better to use printf() correctly, such as printf("%-10.10s%15d%15d%15d\n", n1, g1, w1, p1); The above will insure consistent spacing

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

>>My question is do softwares developed in VB 6.0 work on win vista or not?
Maybe yes, and maybe no. It depends on the software.

>>Do vista come with the visual basic runtime library
I don't know. Tell me the dll name(s) and I'll look to see if its on my computer. I'm running Vista Home Premium, so I wouldn't know about the other versions.

From this page my guess is that you have to install the dlls.

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

start by looking at that link I posted -- they give you all the source code. You will probably have to strip out the MFC stuff and use whatever your compiler supplies. I'm certain it supports TreeView, which is a standard win32 api window type.

As fas as finding the folder names I suppose it uses FindFirstFile() and FindNextFile() to locate the folder names.

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

>>You mean that the client files can only be compiled with the test project ? I
Yes, either the test project or your own program. The test project just show you how to incorporate the client files in your own program. That's the general way of doing it in all the projects you see at that web site.

I suppose if you want to use those client files in serveral different projects then you could compile them into a library (*.lib or *.a) so that they don't have to be compiled with each project. But that's up to you if you want to do it.

>>Is thats it ?
Yes, you got it :)

manzoor commented: Thanks for helping out so fast +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You could write your own -- like this one