|
Amr Shahin wrote: ut for templates they are not compliant with the c++ standard so i think using the void* will be safer!!
are you on drugs ?!
templates are part of and are defined in the standard !!!!!
hey,, i think you should really revise you judgement about templates, and learn a bit more about them...
|
|
|
|
|
Amr Shahin wrote: i think using the void* will be safer!!
Templates were not finalized until the mid to late 90s so compliers created before this may have a problem with them but as long as you stick to the basics and don't use partial template specialization and a few other features you will be fine on older compilers. I have been using templates for at least 5 years starting with VC6 (which is not fully compliant but very capable of using templates). void* is definitly not the way to go if you are using c++.
John
-- modified at 12:09 Tuesday 7th March, 2006
|
|
|
|
|
It looks like most questions for this forum are off topic...
John
-- modified at 9:16 Tuesday 7th March, 2006
|
|
|
|
|
John M. Drescher wrote: It looks like most questions for this forum are off topic...
true, but if people had a look at the admin note...
|
|
|
|
|
Although I have seen it in the lounge I did not even notice it in this forum today...
John
|
|
|
|
|
John M. Drescher wrote: It looks like most questions for this forum are off topic...
True, but i blame MS marketing for this. Most people consider CLI to be "command line interface", not "common language..." (what the heck is I for anyway?).
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Nemanja Trifunovic wrote: (what the heck is I for anyway?).
Common Language Infrastructure...
|
|
|
|
|
Hi Friends
I like to have a Print program that prints text files & having the following features only made in C language using win32 libraries :
1. When run, it needs to present a dialog with where you can select a text file for it to print.
2. There should be options on the dialog to specify how many 'virtual pages' it will print on one page (it should either be 1 (which fills the whole page), 2 (where they are rotated 90 degrees), or 4 (where they are printed using 4 regions of the page)) - this is similar to the old utility LaserLst:
http://fresh.t-systems-sfr.com/linux/src/laserprt.tar.gz:a/laserprt.c
3. It should use a fixed width font, and the user should be able to specify the font size.
4. There should be a print and a print preview button
5. There should be an option to make a black border around the 'virtual page'
6. At the top of each 'virtual page' (outside of the black border) it should show the filename on the upper left, and the page number (ie; 4 of 20) on the upper right.
7. There should be an option to turn on line number printing, in which case it would show the like number prior to the line being listed.
Regards,
Mayur Patel
|
|
|
|
|
Sounds good. And it's even better that you have no questions how to write. So I'm looking forward to the programm. Please present it here. :->
Greetings,
Ingo
------------------------------
PROST Roleplaying Game
|
|
|
|
|
mayur! ur confine my doubt abut the homework assignment and u make me sad by not homework working the doubt. now u will get back but low grade forur work which u doubt did. i will report this a student body. shame on u.
Sincelery yours, Computer Information conSciences Professor and grader, Sharada Ulhas
|
|
|
|
|
hi everyone
im trying to check if my compiler creates a copy of the nonstatic member functions for each object or it just shares the code.
to do that i wrote this code:
/*******************************
#include <iostream>
using namespace std;
class cls
{
public:
int f( )
{
//cout << (void*)(f) <
|
|
|
|
|
firstly, you can be sure that the compiler shares only one copy of the member functions body.
but you could do this to test :
class cls {
public;
void f() {
}
};
void main() {
cls a, b;
printf("%l %l", (void*)(&(a.f)), (void*)(&(b.f)));
}
-- modified at 13:19 Monday 6th March, 2006 (thanks Mike)
|
|
|
|
|
the code u gave me didnt work!!
another thing
if the compiler always shares the space why would static functions exist in the first place???!!!
|
|
|
|
|
Amr Shahin wrote: the code u gave me didnt work!!
why ?? any error ?
Amr Shahin wrote: if the compiler always shares the space why would static functions exist in the first place???!!!
the difference between static/non-static member function are for the implicit this parameter. generally, a member function knows on which object it works on, because it is getting an implicit parameter, which is in C++ the this pointer. i say generally because static member function don't ! they can only perform general task, and can only access static members...
but no way this has to relates with body copies. a function body is written once in the source code, do why would it be loaded multiple times in memory.
the only difference between the calls are the parameters the function receives, but this is a stack problem...
|
|
|
|
|
|
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 ?!
|
|
|
|