คำตอบที่ได้รับเลือกจากเจ้าของกระทู้
ความคิดเห็นที่ 6
จากที่อ่านมาเหมือนต้องการสิ่งที่เรียกว่า Thread
บน Win32APIs มีไว้ให้แล้ว
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682453(v=vs.85).aspx
เข้าไปดูที่เค้าคุยกันมีตัวอย่าง คล้ายๆ กับที่ จขกท อาจต้องการ
นำไปดัดแปลงดูก็จะได้ใกล้เคียง
บน Win32APIs มีไว้ให้แล้ว
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682453(v=vs.85).aspx
เข้าไปดูที่เค้าคุยกันมีตัวอย่าง คล้ายๆ กับที่ จขกท อาจต้องการ
นำไปดัดแปลงดูก็จะได้ใกล้เคียง
▼ กำลังโหลดข้อมูล... ▼
แสดงความคิดเห็น
คุณสามารถแสดงความคิดเห็นกับกระทู้นี้ได้ด้วยการเข้าสู่ระบบ
ฟังก์ชัน interrupt ในภาษาซี
ผมได้โค้ดมาจากหนังสือการเขียนโปรแกรมเล่มหนึ่งเมื่อลองคอมไพล์โดยใช้ คอมไพล์เลอร์ borland 5.5 ปรากฎว่าติด error
รบกวนช่วยดูโค้ดให้หน่อยครับว่าต้องแก้ไขอย่างไรบ้าง
//code program
#include <stdio.h>
#include <dos.h>
/* This program use Timer interrupt 0x1c */
#define TCK 0x1c
/* Prototype declaration */
void interrupt MyIntFunction(void); /* New Interrupt Service Routine */
/* Pointer-to-(Interrupt)function declaration */
void interrupt (*OldIntFunction)(void); /* Old Interrupt Service Routine */
volatile int count = 0;
void main (void)
{
printf("Now ,set interrupt vector\n");
OldIntFunction = getvect(TCK); /* Transfer interrupt vector to
OldIntFunction */
setvect(TCK,MyIntFunction); /* Redirection interrupt vector
to MyIntFunction */
while(count<36) ; /* Loop until count = 36 */
setvect(TCK,OldIntFunction); /* Restore old interrupt function */
printf("Now ,restore old interrupt\n");
}
void interrupt MyIntFunction(void)
{
count++;
OldIntFunction(); /* Call old ISR */
}
//error message from complier borland 5.5
---------- Borland C++ ----------
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
8: Size of 'interrupt' is unknown or zero
17: Undefined symbol 'OldIntFunction' in function main
19: Undefined symbol 'MyIntFunction' in function main
19: Call to function 'setvect' with no prototype in function main
27: Size of 'interrupt' is unknown or zero
27: Declaration syntax error