pointer help

Im using Borland C++. An error occur when I try to compile this:

unsigned char far *videobuffer = (unsigned char far *)0xA0000000L;

the message is: Declaration sintax error.

What is the problem?

Comments

  • : Im using Borland C++. An error occur when I try to compile this:
    :
    : unsigned char far *videobuffer = (unsigned char far *)0xA0000000L;
    :
    : the message is: Declaration sintax error.
    :
    : What is the problem?
    :
    Memory model and segmented architecture.

    unsigned char far *videobuffer = (unsigned char far *) MK_FP(0xa000, 0).


  • Very strange... when I use turbo C++, everthing goes ok!
    But thanks anyway!
  • : Very strange... when I use turbo C++, everthing goes ok!
    : But thanks anyway!
    :

    I guess the explanation is that the "far" keyword is not supported anymore by the new 32-bit versions of BCC...
  • : I guess the explanation is that the "far" keyword is not supported anymore by the new 32-bit versions of BCC...

    What should I use instead?

  • : : I guess the explanation is that the "far" keyword is not supported anymore by the new 32-bit versions of BCC...
    :
    : What should I use instead?
    :
    :

    Nothing. It isn't a standard C/C++ feature, it was only meant to be used in DOS. Of course, as you are compiling 32-bit code, your entire code won't work as video memory will (should, POS win9x) be protected. Instead you'll need to go through the operating system. As BC++ is more used for Windows then Linux, I'll assume you are using Windows. In this case, if you want low-level screen access a decent library to use is SDL (www.libsdl.org). It's simple and quick to get framebuffer level access and it's cross-platform, so actually it doesn't matter whether you are using Windows or Linux (etc).

    If you want higher-level 2D access then there are libraries that go with SDL that will do that or just other libraries in general, and if you want 3D graphics then I would recommend OpenGL (you can do 2D graphics with OpenGL, but I'd recommend a more dedicated library.)

    "We can't do nothing and think someone else will make it right."
    -Kyoto Now, Bad Religion

  • : Nothing. It isn't a standard C/C++ feature, it was only meant to be used in DOS. Of course, as you are compiling 32-bit code, your entire code won't work as video memory will (should, POS win9x) be protected. Instead you'll need to go through the operating system. As BC++ is more used for Windows then Linux, I'll assume you are using Windows. In this case, if you want low-level screen access a decent library to use is SDL (www.libsdl.org). It's simple and quick to get framebuffer level access and it's cross-platform, so actually it doesn't matter whether you are using Windows or Linux (etc).
    :
    : If you want higher-level 2D access then there are libraries that go with SDL that will do that or just other libraries in general, and if you want 3D graphics then I would recommend OpenGL (you can do 2D graphics with OpenGL, but I'd recommend a more dedicated library.)
    :
    : "We can't do nothing and think someone else will make it right."
    : -Kyoto Now, Bad Religion
    :
    Thanks a lot you all... it is a hard way to knowledge...( it is ?)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories