|
|
|
|
I have learn Programming in C for 2 years. But, i wonder how to direct the printer to print the output required?(Command in source code.)
|
|
|
|
|
You're wanting to print something, but I can't tell what. Can you elaborate?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
My problem is like this:(C Language)
-for example to print an output as below to the monitor,
Menu
====
....
we can use the source code as below,
fprintf(stdout,"Menu");
fprintf(stdout,"====");
fprintf(stdout,"....");
-so can i print the same output using printer to produce hardcopy?
-is there any file pointer that assume to the printer, as the "stdout" been assume to monitor.
-on other hand, i also have the same problem with scanning input, isn there any specific file pointer for other input devices such as OMR, Barcode scanner, & etc.
-maybe you can show me some of the example statement in C language.
|
|
|
|
|
Anonymous wrote:
so can i print the same output using printer to produce hardcopy?
Yes, use stdprn instead of stdout .
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
when i start running the program by using file pointer call 'stdprn', problem occured where the preprocessor '# include <...>' for 'stdprn is not included in the source code. can i know which type of header file include this file pointer???
|
|
|
|
|
Admittingly, it's been over 10 years since I've used that particular stream. Back then I was using Borland C/C++ to create DOS programs. Maybe it's from that era that I remember it.
There's the off-chance that you might could use:
#define stdprn (&_iob[3])
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I posted a thread about how to detect cdrw and MO,but it didn't get appropriate answer.I just use the way as showed below to do it.
/ **************************************************
**
BOOL GetDriveGeometry(HANDLE hDevice, PGET_MEDIA_TYPES pMediaTypes)
{
DWORD dwOutBytes;
BOOL bResult;
bResult = :eviceIoControl(hDevice,
IOCTL_STORAGE_GET_MEDIA_TYPES_EX,
NULL, 0,
pMediaTypes, MEDIA_INFO_SIZE,
&dwOutBytes,
(LPOVERLAPPED)NULL);
return bResult;
}
**************************************************
***
I can get all CD driver(including cdrom and cdrw,but just as CD driver) with GetDriveProperty.The reason why I get cdrw as CD driver because their value of
"pMediaTypes->MediaInfo[0].DeviceSpecific.DiskInfo.MediaType" all is "CD_ROM".
I want to know the driver's r/w attribute by its parameter of
"pMediaTypes->MediaInfo[0].DeviceSpecific.DiskInfo.MediaCharacteristics" ,but result is still "read only".
please give me some suggestion.
thank you.
Happy Gemini
|
|
|
|
|
I'm working on a document and am looking to use standard terminology where possible:
There are built-in data types (e.g., int, float, char*, etc) and there are objects. I'm looking for a commonly used term that refers to either. Is there such a term?
Is there a name for the program initialization activity when global C++ objects are initialized at run time? (This happens before main() gets invoked I know, but what is this initialization activity called?)
Thanks,
Matt
|
|
|
|
|
for the first one it is identifier and for the second one startup, bootloader, prolog.
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
Matthew Busche wrote:
There are built-in data types (e.g., int, float, char*, etc) and there are objects. I'm looking for a commonly used term that refers to either. Is there such a term?
Intrinsic types are built-in.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi!
I need to create resizable dialog window with title, close box and NO ICON. I tried to set resizing border and "hide" icon with resource editor but it looks impossible. When I set "palette window" true, icon disappears, but I don't need palette window.
How to remove it? I tried to make icon transparent, but margin on title bar looks a bit strange
|
|
|
|
|
Hey all,
I have a minor design issue here. I've uploaded this picture to illustrate it:
http://www.blacksmith-studios.dk/example_dlg.jpg
Imagine the user can select various actions in the list control on the left. Then I'd like to show some appropriate properties for the selected action. That is, the actions are different and therefore require a different set of properties.
I've thought of the following solutions:
- Make a borderless dialog and create it with the width and height that matches the right group-control's size (thus creating a new class for every new property window to handle the user interaction!?).
- Make some kind of property list control.. It's just that I don't know if it's possible to display all the options I want in a listcontrol!
Since I'm no expert at all on MFC I'd really like some of you guys' input on how to achieve the desired effect!
Thanks in advance,
Soren Dreijer
|
|
|
|
|
I want to know the right code MFC to obtain the IP of the Current system and that of allthe nodes of the network it is sharing???
May the Lord bless thee abundantly
|
|
|
|
|
Chechi wrote:
I want to know the right code MFC to obtain the IP of the Current system...
Try gethostname() followed by gethostbyname() .
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
i am going slightly out of track, but my question is that is it possible to obtain ipaddress of a computer, when it is not connected to network. say u run mfc application on your computer and it prints out the ipaddress of your machine. i was wondering if there was any function available in mfc for this purpose.
thanks.
Avi
|
|
|
|
|
aroraavinash wrote:
i was wondering if there was any function available in mfc for this purpose.
No, but there are plenty of classes available here at CP.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I tried it and got the address as 127.0.0.1 and am not sure it is right or not..
Please do help..
May the Lord bless thee abundantly
|
|
|
|
|
Chechi wrote:
and that of allthe nodes of the network it is sharing???
Take a look at:
WNetEnumResource function continues an enumeration of network resources that was started by a call to the WNetOpenEnum function.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Hi all,
I have the following situation: I have a MyDataSource.h and MyDataSource.cpp files that define and implement a simple C++ templated class:
// MyDataSource.h file
<code>
#ifndef _MYDATASOURCE_H
#define _MYDATASOURCE_H
template <class T>
class Test
{
public:
Test(T * source);
~Test();
void TestMethod();
private:
T* m_source;
};
#endif
</code>
// MyDataSource.cpp file
<code>
#include "MyDataSource.h"
template <class T>
Test::Test(T * source)
:m_source(source)
{}
template <class T>
Test::~Test()
{}
template <class T>
void Test::TestMethod()
{}
</code>
However, when I compile this. I get the following build errors that I have been unable to resolve.
i:\Thesis\Source Code\App\TemplateTests\MyDataSource.cpp(4): error C2955: 'Test' : use of class template requires template argument list
i:\Thesis\Source Code\App\TemplateTests\MyDataSource.cpp(6): error C2244: 'Test<T>::__ctor' : unable to match function definition to an existing declaration
i:\Thesis\Source Code\App\TemplateTests\MyDataSource.cpp(9): error C2955: 'Test' : use of class template requires template argument list
i:\Thesis\Source Code\App\TemplateTests\MyDataSource.cpp(10): error C2244: 'Test<T>::~Test' : unable to match function definition to an existing declaration
i:\Thesis\Source Code\App\TemplateTests\MyDataSource.cpp(13): error C2955: 'Test' : use of class template requires template argument list
i:\Thesis\Source Code\App\TemplateTests\MyDataSource.cpp(14): error C2244: 'Test<T>::TestMethod' : unable to match function definition to an existing declaration
However, if I put the implementation in the .h file, then everything compiles fine. What do I need to do to get rid of these errors?
Thanks,
Sincerely,
Xargon
Without struggle, there is no progress
|
|
|
|
|
pankajdaga wrote:
What do I need to do to get rid of these errors?
Do what you already tried - put it into the header file.
VC++ (and almost all other C++ compilers) currently can't compile a template where the declaration of a template class is separate from it's implementation. This is addressed through the export template feature in the C++ standard. However, pretty much nobody supports it because it's a freaking pain in the arse to do. For the time being, keep it all in the same file.
--
Ian Darling
"The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
|
|
|
|
|
Ian Darling wrote:
VC++ (and almost all other C++ compilers) currently can't compile a template where the declaration of a template class is separate from it's implementation. This is addressed through the export template feature in the C++ standard. However, pretty much nobody supports it because it's a freaking pain in the arse to do. For the time being, keep it all in the same file.
Sorry to say, but this is not entirely correct IMHO. The OPs problem is that he didn't use the right syntax as he forgot the template parameter after the class name:
template <class T> Test<T>::Test(T* source)
It's not necessary to define the template at the point of declaration (i.e. in the header file). It's perfectly legal to define the template in a cpp file. However, it's true that the declaration and the definition has to be in the in the same translation unit, and one solution to this is to put the definition in the header along with the declaration. I usually put the definition of template member functions in a .inc (include) file that is included at the end of the .h file, but that's just my personal preference.
What is true is that you cannot export a template - you'll get a LNK2001 error. Since templates are a compile-time object it doesn't make sense to export it anyway, so the C++ standard should be changed to omit the export template feature. What you can do is export instantiations of the template (unless you use VC++ 6.0 which will give you an internal compiler error if you try).
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
You can put it in its own cpp file.
template <class T> class Test
{
public:
Test(T * source);
~Test();
void TestMethod();
private:
T* m_source;
};
// in cpp
template <class T> Test<T>::Test(T* source)
{
}
template <class T> Test<T>::~Test()
{
}
template <class T> void Test<T>::TestMethod()
{
}
This works for me 2002
Thank You
Bo Hunter
|
|
|
|