Isaac Remuant 40 Newbie Poster

mmm, if the whole point is avoiding accidental changes to Bla's date field then you could use const_cast.

http://www.cppreference.com/wiki/keywords/const_cast

char* ReturnDate(Bla const& blabla)
    { 
        //strcpy_s(blabla.date,8,"assssde");  <- This would give you a compiler error.
        return const_cast<char*> (blabla.date);
        
    }

Don't just trust me. Do some research. It's been some time since I fiddled with this and my memory is rusty. I'll look into this later, If I can

Isaac Remuant 40 Newbie Poster

You need to make an array of students and loop through the elements of that array.

Some links about c++ arrays for reference:
http://www.cplusplus.com/doc/tutorial/arrays/
http://www.learncpp.com/cpp-tutorial/61-arrays-part-i/

Isaac Remuant 40 Newbie Poster

You can't manually clear the memory of static arrays. The memory of that array won't be cleared until you leave the scope where it was declared (scope is, in this case, the space within the curly braces)

example:

void exampleFunc()
{
  int aaa[32];
} //when the function closes, the memory where the aaa array resides will be cleared.

int main()
{
  int bbb[10]; //reserves 10 
  for(int iii=0;iii<3;iii++)
  {
    exampleFunc();   
  }
  
} //when the main loop closes, the bbb memory will be cleared.

Each time there's a call for exampleFunc, the application will allocate memory for the array and, each time it ends, that memory will be cleared.

If you wanted to be able to clear and assign memory you should look into new/delete (c++ proper) or malloc/free (c).

http://www.cplusplus.com/doc/tutorial/dynamic/

Isaac Remuant 40 Newbie Poster

I'll start by saying I've used blender but I've never used the Game Engine.

Are you trying to export information from a c++ application to be able to read it later from the Blender Game Engine or you're talking about using c++ to manage the it?

If it's the latter, you probably don't have much of a choice but to learn python. Approach it slowly, and you'll probably have no troubles with it. You might even be able to throw some c++ if you need:
http://docs.python.org/extending/extending.html

If it's the former... You can save to any file format of your choosing and loaded with a specific blender importer (or even one of your own making with python)

Isaac Remuant 40 Newbie Poster

Do you have to use c strings or can you use c++ strings?

Here you have both references (c-style strings and c++ strings)

http://www.cplusplus.com/reference/clibrary/cstring/
http://www.cplusplus.com/reference/string/string/

For the 1st problem, use the lenght function.
2nd, check the string character by character until
A) You find a non digit (correct)
B) The string ends (Incorrect password, all digits)
(You must compare the ASCII codes)

3rd. Same thing, but check the entire string for a space.

Remember you need to enclose your code in quote tags.

Isaac Remuant 40 Newbie Poster

You don't actually delete that because it's a visual aid. What you can do is disable that particular visual aid.

What you want to do is go to EDIT -> ADVANCED -> View White Space to toggle that aid on or off. There's a couple of other aids you might want to toggle too.

Ancient Dragon commented: nice help :) +34
Isaac Remuant 40 Newbie Poster

Are you using the same google I'm using...? :S

first result for C1083:
http://msdn.microsoft.com/en-us/library/et4zwx34(VS.80).aspx

Set your include directory to the path that contains the header you need. That's the solution.

But, as you don't seem to be familiar with libraries, you'll probably encounter one problem after the other.

Reading material:
http://www.learncpp.com/cpp-tutorial/a1-static-and-dynamic-libraries/
http://www.learncpp.com/cpp-tutorial/a2-using-libraries-with-visual-studio-2005-express/

Isaac Remuant 40 Newbie Poster

Instead of opening a new post with every problem you encounter you should do as you were advised in your other posts and learn how to do a couple of things before attempting to use this tool you don't know.

You need to learn how to use libraries with Visual Studio 2005/2008/2010. Google is there for you and has a lot, you'll waste time waiting for answers here.

Can you answer this questions?
1) Why are you using precompiled headers?
2) How do you use libraries which only have header files?
3) How do you link a static or dynamic library to a project?
4) How do you USE that library.

Learn those.

Also, Google the error Codes that the compiler gives you and learn what they are and how to fix them. In this case, google C1083.

Isaac Remuant 40 Newbie Poster

It's like if you were trying to jump steps.

What library are you using to interact with an SQL database? If your answer is none... Then you need to learn how to link and use libraries with your compiler. If there's a lib or API you're using. What you need is there. Read the documentation!

jonsca commented: Good observation +5
Isaac Remuant 40 Newbie Poster

I always recommend learncpp.com as a great starting point. Very easy to follow.

Isaac Remuant 40 Newbie Poster

You won't always find a laid out tutorial for you but a quick glance at the documentation will many times tell you enough for you to make your own samples.

Remember you can read header files too.

This is has a good c++ API for handling databases in the client's computer.
http://www.sqlite.org/

Isaac Remuant 40 Newbie Poster

Isn't it created when you compile, your program, saad749?

I don't use that compiler but there should be a specific directory (maybe debug or release) where your .exe is being produced on compilation.

You can execute that file just like any other executable.

Isaac Remuant 40 Newbie Poster

correct syntax:

<return type> <function name> (<type> <array name>[]);

You're mixing up concepts.

remember that arrays are passed automatically by reference in c++. I suggest you read about references, pointers and passing arrays into functions.
http://www.learncpp.com/cpp-tutorial/611-references/
http://www.learncpp.com/cpp-tutorial/612-references-vs-pointers-and-member-selection/
etc.


This will do what you ask:

#include <iostream>

using namespace std;

struct mystruct
{
int x;
};

void myfun(mystruct m[])
{
cout<<m[0].x; 
}

int main()
{
mystruct m[3];
m[0].x=2;
m[1].x=3;
m[2].x=4;
myfun(m);
}
Isaac Remuant 40 Newbie Poster

The wording of this post is weird. Maybe posting the relevant code in CODE tags might help.
You can't return arrays. You can return a pointer to an array though.
What do you want to do? Use that array within a function? In that case, I recommend you to google how to pass an array as a paramater in a function.

Isaac Remuant 40 Newbie Poster

You might find interesting source code samples from the book "Programming AI by Example" from Matt Buckland.

Check out the Lua projects. Do not copy paste. Much of that code is educational and a graphic adventure probably requires a pretty good design to avoid spaguetti patterns.

Isaac Remuant 40 Newbie Poster

I use libvorbis with OpenAl so I immediately thought about Theora.
http://www.theora.org/downloads/

A quick google search also brought up this:
http://sourceforge.net/projects/libtheoraplayer/

It's open source and royalty free but I don't know how suitable it migth be for games.

Apparently, Ogre has a plugin, that could prove an interesting read:
http://forums.indiegamer.com/showthread.php?t=16110

Let us know what you end up doing and what your experiences are if you can. It might be pretty useful.

Isaac Remuant 40 Newbie Poster

IF you ever need to change this option from within the project go to linker->System

and where it says subsystem choose either:
Console (/SUBSYSTEM:CONSOLE)
Windows (/SUBSYSTEM:WINDOWS)

The point of Glut is to test OpenGl without having to mess with a Window API so stick to console projects.

Isaac Remuant 40 Newbie Poster

Add VendMachine.cpp to your project. What compiler are you using?

Isaac Remuant 40 Newbie Poster

Think about it. It's not hard and there's quite a few ways to accomplish it.

Before, you wanted 25 possible consecutive ASCII codes.

Now you want 50 (in groups of 25 and 25 starting from 'A' 65 and 'a' 97.

Isaac Remuant 40 Newbie Poster

Ok, here's some links you should check out and below, a simple example.

Try it out, make changes, read the documentation and enjoy the endless possibilities it provides.
rand() function
http://www.cplusplus.com/reference/clibrary/cstdlib/rand/
srand() function (generates a random seed)
http://www.cplusplus.com/reference/clibrary/cstdlib/srand/
Time library from c where we can get the time_t time ( time_t * timer ); function
http://www.cplusplus.com/reference/clibrary/ctime/
ASCII codes:
http://es.wikipedia.org/wiki/ASCII

#include <iostream>
//ctime is used to set the random seed.
#include <ctime> 

int main(int argc, char** argv)
{
  using namespace std;
  /*Initializes de seed to use the current time
  so that the numbers are different each run 
  of the application*/
  srand((unsigned)time(NULL));
  
  /*Check the ASCII code values.
  Lowercase goes from a = 97-> z=122 
  Uppercase goes from A = 65 -> Z=90 */

  //rand() returns a number between 0 and RANDMAX
  
  //arbitrarily, I decided to show 40 random letters
  for(int iii=0;iii<40;iii++)
  {
    char letter = rand()%25 + 65;
    cout<<letter<<" ";
  }

  /*
  Exercise 1: change 65 to 'A' 
  Exercise 2: change 65 to 'a'
  3: Use a number as a seed (instead of the time(NULL) function) 
  and you'll always get the same succession of random numbers"
  4: Test and research 
  */
}

Good luck and remember, be specific when you ask for help and show what you have done so far.

http://www.catb.org/esr/faqs/smart-questions.html

EarendurRingern commented: nice +1
Isaac Remuant 40 Newbie Poster

You probably need to be more specific as to what you need to get any help.

Good advice if you're stuck is to turn of your screen and grab pen and paper and think it over until you know what you want to do. Then coding comes easier.

Get on with it! Deadline is on Monday! :P

Isaac Remuant 40 Newbie Poster

The #include directive will, depending on wether it uses "" or <>, look in different places of your system to find the required files to compile.

<> looks in your compiler's include directory. With Visual Studio this could be by default:
C:\Program Files\Microsoft Visual Studio 9.0\VC\include

"" first looks in your project folder and, if it doesn't find it ther, it will look in the compiler's include directory.

Note that you can set up more inclusion directories with your compiler.

So, make sure you have the apvector.h file in the proper place.

Isaac Remuant 40 Newbie Poster

You're using ifstream instead of ofstream in this line:

ifstream file ("C:/Users/Brandon/Desktop/test.txt", ios::out | ios::app | ios::binary); //file to write

You must also take into account that you won't be able to create files outside of the folder of your executable. You won't even be able to create a folder with plain c++ libraries.

then it should be something like:

ofstream file ("data/test.txt", ios::out | ios::app | ios::binary); //file to write

TIP: output a message after each error check so you can see where it specifically failed.

Isaac Remuant 40 Newbie Poster

Hi, I've googled myself into this site many times and felt it was about time to make that tie stronger.

Maybe I can even help if there's no one else around.

I'm interested mostly in c++ programming at the moment.