[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] c prog til styring af printerport



On Wed, 16 Feb 2000 18:30:20 +0100, Lord Nikon A.K.A Daniel Pedersen
<sslug@sslug> wrote:
> Hej
> Jeg skal bruge lidt hjælp.
> 
> Jeg kan ikke finde ud af at skrive til en printerport. Da min compiler
> påstår at den ikke kende comandoen outportb eller inportb .

Disse er specifikke for DOS. Under UNIX skal du bruge outb og under Linux skal
du først bruge ioperm. - og så skal du lige huske at vende parametrene om på
outb!
 
> #define DATA 0x0378
> #include <iostream>
> 
> void main(void){
>         int val1= 0x81;  /* Data bits 7 og  0 sættes til 1 */
>            outportb(DATA, val1);
> }
> 
> hvad skal jeg gøre anderledes ????

#define DATA 0x378
#include <sys/io.h>

int main(void) {
  int val1 = 0x81
  if (ioperm(DATA,3,1)) {perror("ioperm");exit(1);}
  outb(val1,DATA);
  if (ioperm(DATA,3,0)) {perror("ioperm");exit(1);}
  exit(0);
}

skulle kunne gøre det.

-- 
Most kind regards,
Kristian Bjoernskov, <mailto:sslug@sslug>
Novo Nordisk IT, Network - internet.
Phone: +45 4442 3299. Fax: +45 4442 6061


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *