PDA

View Full Version : Ansi C



dosti
22nd November 2006, 09:52 AM
hi

i want u use C language to output data and get input from parallel port in fedora core 4

using C languge would anyone guide me from where i shuld start actually i found

no 'include<dos.h>' header file which is usually contains the function to handle parallel

port in gcc ............plz do tell me about any tutorial,web link,or a good place for such queries...




Degards
dosti

markkuk
22nd November 2006, 01:28 PM
The <dos.h> header or any functions to access parallel ports aren't part of the ANSI C standard. On Fedora Core, use the libieee1284 library (http://cyberelk.net/tim/libieee1284/index.html):

yum install libieee1284-devel

dosti
23rd November 2006, 07:24 AM
thanks markkuk

dosti
28th November 2006, 07:09 AM
plz tell is it not an approprite headerfile for interecting with parallel poryt in core 4......

/usr/include/linux/parport.h files.

jacques_basson
28th November 2006, 12:47 PM
3 ways (that I know of) to do parallel port programming

1) parapin (http://parapin.sourceforge.net/)
2) ppdev (search google for it)
3) My personal favourite (quick, but almost completely non-portable :) ) - use io ports

Here is some code for option 3.

#include <string.h>
#include <sys/io.h>
#include <stdio.h>
#include <stdlib.h>

#define BASEPORT 0x378 /* lp0 */

int main(int argc, char **argv)
{
/* Get access to the ports */
if (ioperm(BASEPORT, 3, 1)) {
perror("ioperm");
exit(1);
}

outb(0, BASEPORT);
sleep(1);
outb(1, BASEPORT);

return 0;
}

dosti
17th December 2006, 07:02 PM
thanks basson

dosti
17th December 2006, 07:15 PM
hi

Can anyone tell me how to access serial port of my pc running fedora core 4..............is there some headr file or i have to us some library

markkuk
18th December 2006, 12:42 AM
See the Serial Programming Guide (http://www.easysw.com/~mike/serial/serial.html) and Serial Programming HOWTO (http://tldp.org/HOWTO/Serial-Programming-HOWTO/index.html).

dosti
23rd December 2006, 06:44 PM
markkkuk thanks alot