Thread: interrupt error

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    28

    interrupt error

    hi dear!

    i am trying this but some errors are generated.
    help me in correcting that.
    for example :1st error is that cant convert void <interrupt far*> <...> to void <interrupt far*><>

    Code:
    #include<dos.h>
    #include<conio.h>
    void interrupt (*old) ();
    void interrupt newint();
    char far *scr = (char far*) 0x00400017;
    
    void main()
    {
    	clrscr();
    	old = getvect(0x08);
    	setvect(0x08,newint);
    	keep(0,1000);
    	getch();
    }
    void interrupt newint()
    {
    	*scr = 64;
    	(*old) ();
    }

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    It would help if you give the line-number that the error is on.

    Also, are you ACTUALLY doing this in a DOS (or dos-like) system, or are you running this in Windows?

    You may want to set the vector back again before you exit too!

    If you want to turn on NumLock or some such, there are probably better ways to do that.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    and the hat of copycat stevesmithx's Avatar
    Join Date
    Sep 2007
    Posts
    587
    What compiler are you using?. Is it TurboC?
    Also unless you have valid reason to learn TSR, don't learn it as they are obsolete nowadays.
    You may want to set the vector back again before you exit too!
    But isn't that handled here?
    Code:
    void interrupt newint()
    {
    	*scr = 64;
    	(*old) ();
    }
    Last edited by stevesmithx; 01-16-2009 at 05:34 AM.
    Not everything that can be counted counts, and not everything that counts can be counted
    - Albert Einstein.


    No programming language is perfect. There is not even a single best language; there are only languages well suited or perhaps poorly suited for particular purposes.
    - Herbert Mayer

  4. #4
    Registered User
    Join Date
    Jan 2009
    Posts
    28

    re

    i am using in turbo c
    and the os is windows xp.

    error is generated in
    old = getvect(0x08);
    setvect(0x08,newint);

    these two line

  5. #5
    Registered User
    Join Date
    Jan 2009
    Posts
    28

    re

    i am studing system programing so thats why i am asking for this.

    no any more reason

  6. #6
    and the hat of copycat stevesmithx's Avatar
    Join Date
    Sep 2007
    Posts
    587
    i am using in turbo c
    Then i think you are probably using an older version version of Turbo C.
    Compiles fine for me in Turbo C ver 3.0 though.

    and the os is windows xp.
    Then you probably need a real DOS and not just an emulation to see the output, i think.
    Not everything that can be counted counts, and not everything that counts can be counted
    - Albert Einstein.


    No programming language is perfect. There is not even a single best language; there are only languages well suited or perhaps poorly suited for particular purposes.
    - Herbert Mayer

  7. #7
    Registered User
    Join Date
    Jan 2009
    Posts
    28

    re

    yes i am using turbo c version 3.0 .

    do you mean to say that in windows xp i cant run it.

    and in windows 95 or 98 i can run it.

  8. #8
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Windows XP does not run in a DOS-environment. The fact that it provides DOS prompts at all is because it emulates DOS environment - to a degree at least.
    You would have to use DOS itself or an earlier OS at least to use the "real" DOS.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #9
    and the hat of copycat stevesmithx's Avatar
    Join Date
    Sep 2007
    Posts
    587
    do you mean to say that in windows xp i cant run it.

    and in windows 95 or 98 i can run it.
    Probably, yes.
    Not everything that can be counted counts, and not everything that counts can be counted
    - Albert Einstein.


    No programming language is perfect. There is not even a single best language; there are only languages well suited or perhaps poorly suited for particular purposes.
    - Herbert Mayer

  10. #10
    Registered User
    Join Date
    Jan 2009
    Posts
    28
    thx
    ...............

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 01:10 AM

Tags for this Thread