在并行端口写入数据 [英] Writing data in parallel port

查看:63
本文介绍了在并行端口写入数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要在计算机的并行端口中写入数据,因此我使用了
outportb(0x378,0xAA); C语言,但出现以下错误,

error LNK2019: unresolved external symbol _outportb referenced in function _main

我已经包含了dos.h,无论必须包含任何头文件还是必须更改任何设置.

请帮助我解决这个问题.


谢谢&问候
Mohan

Hi,

I need to write a data in the parallel port in the computer, so I make use of
outportb(0x378,0xAA); in C language but I get the below error,

error LNK2019: unresolved external symbol _outportb referenced in function _main

I had included dos.h, whether any header file has to include or any settings has to change.

Please help me with this issue.


Thanks & Regards
Mohan

推荐答案

您可以使用Inpout32.dll在此处 [
You can use Inpout32.dll available here[^] to write and read to the parallel port. Also, Here[^] is an example using Inpout32.dll with VC++.


该错误发生在链接时.您的程序编译正常,但是在生成exe时需要包括包含outportb的库.该库的名称取决于您的构建工具.请注意,如果您使用的是Vista或Windows 7,则您的程序将无法运行.

祝你好运,
彼得
如果您喜欢答案,请对其投票并标记为接受.
The error is at LINK time. Your program compiled OK, but you need to include the library that contains outportb when you build the exe. Just what that library is called depends on your build tools. Be warned that if you are using Vista or Windows 7, your program will not work.

Good luck,
Peter
If you like the answer, vote for it and mark it accepted.


如果您尝试在Windows XP平台上执行此操作,则不会工作.即使您找到了可以编译该程序的编译器和库,Windows XP也不会允许用户程序直接访问硬件,包括使用outportb写入I/O端口.您会收到运行时错误.
If you are trying to do this on a Windows XP platform, it won''t work. Even if you found a compiler and library that would compile the program, Windows XP will not let a user program access hardware directly including writing to I/O ports with outportb. You would get a run-time error.


这篇关于在并行端口写入数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆