Howdy, Stranger!

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

Categories

pointer help

gustavosserragustavosserra Member Posts: 201
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

  • jeffpostjeffpost Member Posts: 316
    : 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).


  • gustavosserragustavosserra Member Posts: 201
    Very strange... when I use turbo C++, everthing goes ok!
    But thanks anyway!
  • blitzblitz Member Posts: 620
    : 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...
  • gustavosserragustavosserra Member Posts: 201
    : 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?

  • DariusDarius Member Posts: 1,666
    : : 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

  • gustavosserragustavosserra Member Posts: 201
    : 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 ?)

  • Shawn CarterShawn Carter Member Posts: 0

    ____ || http://forcoder.org || free video tutorials and ebooks about { Objective-C, Visual Basic .NET, Perl, Swift, Delphi, JavaScript, PHP, C++, C, Assembly, Java, C#, Visual Basic, PL/SQL, Ruby, Python, Scratch, R, Go, MATLAB Apex, Hack, Transact-SQL, Alice, Dart, Prolog, Erlang, Lua, Logo, VBScript, FoxPro, Crystal, COBOL, Scheme, Kotlin, Lisp, D, LabVIEW, Awk, ML, Bash, Rust, Scala, Ada, ABAP, SAS, Julia, F#, Clojure, Fortran } __

Sign In or Register to comment.