|
i tried ur code and it gave me the following error:
/***********************
test.cpp:13: error: invalid use of non-static member function ‘void cls::f()’
test.cpp:13: error: converting from ‘void (cls: ()’ to ‘void
****************************!!!/
any ideas ??
|
|
|
|
|
Hi, I'm new to parallel port. Just to seek some help from here.
I've downloaded the Borland C++ 5.5 command line compiler...(I've followed all the steps required)
I also copied "inpout32.dll" to my system directory (C:\WINDOWS\system)
I'm using Windows 98... (LPT1 0378H)
But why I still can't run my programs? (written in C)
#include "stdio.h"
#include "dos.h"
#include "conio.h"
/********************************************/
/*This program set the parallel port outputs*/
/********************************************/
void main (void)
{
clrscr(); /* clear screen */
outportb(0x378,0xff); /* output the data to parallel port */
getch(); /* wait for keypress before exiting */
}
-- modified at 21:24 Friday 3rd March, 2006
|
|
|
|
|
OK, let me be the first to tell you that you posted this question to the wrong forum. This is the C++/CLI forum.
I think your best bet would be to ask this question in the Hardware forum (since you're using Borland C++, I don't think the Visual C++ forum would be appropriate).
Having said that, I'll take a go at your problem (but you'd probably get a better answer over in Hardware): I believe that the free Borland C++ 5.5 is a Win32-only compiler, so I assume that's why you including that inpout32 DLL.
I'm pretty sure the code you wrote would work OK in Borland C++ 5.02 (or older) if you have it produce a 16-bit MS-DOS executable. Functions like outportb() are native to the compiler, and I don't think that 5.5, being a 32-bit compiler, even has those I/O functions. What you need to do is call the 32-bit functions in the DLL.
Assuming you're using the logix4u DLL, you can find a sample working program for Borland C++ here: http://www.hytherion.com/beattidp/comput/pport.htm[^]. The Test2.C program you'll find there should do the trick, I think.
Hope that helps.
|
|
|
|
|
Sorry, I'm new to this site. Anyway, thanks for replying my message.
I've gone through "http://www.hytherion.com/beattidp/comput/pport.htm" Test2.C..
In order for the programs to work correctly with Borland 5.5, I have to add this two additional lines to it? Please advice.
#include "stdio.h"
#include "dos.h"
#include "conio.h"
/********************************************/
/*This program set the parallel port outputs*/
/********************************************/
short _stdcall Inp32(short portaddr);
void _stdcall Out32(short portaddr, short datum);
void main (void)
{
clrscr(); /* clear screen */
Out32(0x378,0xff); /* output the data to parallel port */
getch(); /* wait for keypress before exiting */
}
-- modified at 10:02 Sunday 5th March, 2006
|
|
|
|
|
Adding those two lines would make the program work if you had one of the commercial Borland compilers. With any of the commercial versions you get a utility called IMPLIB that you would use to tell the compiler how to link to the functions in inpout32.dll. Since the free version 5.5 doesn't come with any utilities, you have to go through a more-complex technique of dynamically loading inpout32.dll.
That's why Test2.c is so much more complicated than your example; somewhere in there you'll see a call to the Win32 LoadLibrary() function, which is the heart of the dynamic loading technique. Though, as you can see in there, there are a lot of housekeeping details to take care of.
So, I think you have two choices:
1. Try compiling Test2.c, and if that's successful, study it until you understand it well enough to modify for your purposes.
2. Buy a commercial Borland or Microsoft compiler so you can use the simpler code you posted in your message. Another alternative might be the free Open Watcom[^] compiler, if it happens to come with an IMPLIB utility.
Good luck!
|
|
|
|
|
OK! I think i would go for Microsoft VC++ compiler because my college has it! I think that would be more easier right?
Thanks for your advice
|
|
|
|
|
Sure, that sounds reasonable. Just make sure it has the IMPLIB utility -- I don't think Visual C++ 2005 Express Edition has it, but I think all the other editions (and other years' editions) do have it.
|
|
|
|
|
Hello Every One
I need your help to make a programm in C++
The program convert the dicemal numbers to binary using Recursion ..
I hope That you can help me ..
Waiting for you ..
|
|
|
|
|
There is no decimal or binary numbers. This is just a language misuse. A number is a number and is independent of its representation which can be decimal, hexadecimal, binary, ...
A small example (yup, for thos who know, it's still the good one with the apples ). So, let's say you have 21 apples on a table, you can say "I have 21 apples", or "I have 0x15 apples" or "I have 0b10101 apples". You still have the same number of apples on your table, no matter which representation you use.
So, your question make as much sense as asking "I want to convert my 21 apples in binary, how to do that ?"
So, what you want to do exactly ? Converting a number into a string in binary or what ?
|
|
|
|
|
is it me, or we are repeating ourselves these days ?!
|
|
|
|
|
I don't know why but I have exactly the same feeling
I think I will make a standard post and make a copy-paste each time. Maybe with some variations: instead of apples I can choose bananas, pears, oranges and why not fishes ?
|
|
|
|
|
i am personnaly getting a bit bored and am thinking of storing a link of a good answer on the subject, then only paste it as a reply...
especially when the question is asked in the wrong forum
|
|
|
|
|
Thaaaaaanx alot every body for your replies
and I hope find answer for my quistion
Iam Sorry if I put my quistion in the wrong forum
but Iam new user
....still waiting for your help....
|
|
|
|
|
Thanx alot for your explain
now I undestand the difference
ofcourse I mean convert the decimal numbuer to a binary string
So .. can any body help me??
|
|
|
|
|
Take a look at _ltoa[^] function. It will convert a number into a string and you can specify the base of the value (2 in your case).
|
|
|
|
|
see this code .. try to apply it
Iam very happy .. Thanx alot for your helping
let's see the code .. if you have any guestion I will help you
#include <iostream.h><br />
#include <conio.h><br />
<br />
void convert(int i) {<br />
if(i > 0) {<br />
convert(i/2);<br />
cout << i %2;<br />
}<br />
}<br />
int main() {<br />
int a;<br />
cout<< "Please Enter The Number That You Want To Convert >> \t";<br />
cin >> a;<br />
convert(a);<br />
getch();<br />
return 0;<br />
}
|
|
|
|
|
Ouch, sorry, I forgot that you wanted to do with recursion (is it a homework BTW ?)
Yup, I think this will work (didn't check it in detail but it looks correct).
|
|
|
|
|
any way .. thanx thanx thanx for your helping ..
you are a good teacher and intellegent one ..
I hope that this code will be usefull for every body in this website ..
See You
|
|
|
|
|
I got
remoteAccess error LNK2019: unresolved external symbol __imp__AlphaBlend@44 referenced in function _WinMain@16
when I use AlphaBlend api, I included windows.h in my source code and I can use other windows api without any problem ( I can use BitBlt too which I assume it located in the same dll as AlphaBlend, gdi32.dll)
|
|
|
|
|
|
resolved, thanks, FAQ is useful
|
|
|
|
|
plz tell me something about how to get L2 CACHE SIZE AND SPEED of any system in Visual C++ ....
Plz send me exact code for that
Thanking You.
Sincerely,
VIRAL PATEL
|
|
|
|
|
Before I answer, answer me this: why would you need such information? What are you doing?
-- modified at 11:48 Thursday 9th March, 2006
|
|
|
|
|
Please help me somebody..im not good in programming..
i really need someone help to guide me please i need to design an abstract data structure to represent matrices then i have to overload the *, + and - operator so that they perform the correct operation accordingly for matrices. My friends said that i have to use the two dimensional arrays but then i still can figure out i have to implement a two dimensional dynamic array to represent the matrix. This is the following code that shows me on how to define a two dimensional
dynamic array of any size (in the example below the size is 2 by 2):
int **matrix;
int rows = 2;
int cols = 2;
matrix = new int *[rows];
for(int i=0; i
|
|
|
|
|
Check out matrix TCL Lite[^].
It is a relatively simple matrix implementation. There are more complicated better performing libraries out there, but they aren't easy to learn from.
Using the GridView is like trying to explain to someone else how to move a third person's hands in order to tie your shoelaces for you.
-Chris Maunder
|
|
|
|