|
andreas_sweden wrote: BytesToWrite = sprintf( (char *)szBuffer,
"\033F\r\033B 512 600 4 1 2 3 150 1 "&Argument&"\r\033I\r");
Try:
sprintf(szBuffer, "\033F\r\033B 512 600 4 1 2 3 150 1 %s\r\033I\r", argv[1]);
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Thankyou thankyou * 10000
Very much!
Everything works just fine!!!
Mucho Gracias!
/Andreas
|
|
|
|
|
I've tried to overload the << oprator, so that I can output to a file and to a console at the same time but I have no success. I cannot find a solution in Internet and I get the error message: ambigous overload of operator <<...
Any ideas what to do?
I want to be able to use this operator to output something like:
logfile << "data";
but still to be able to do this:
cout << "out";
Thank you!
|
|
|
|
|
i'm not sure i understand.
you want - in the same << operation - that your datas are written both in a file and in a console ?
there's no need to overload such an operator for this.
you write a function say writeOutput(data_to_write) in which you perform a cout << data and a file << data where file is an ifstream opened with the file to write...
if not, please explain more clearly...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20]
|
|
|
|
|
Yes you are right but I want to be able to use variable number of arguments but I don't want to use va_list, etc... C functions.
|
|
|
|
|
Cristoff wrote: but I don't want to use va_list, etc... C functions
however, it is the way to do it...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20]
|
|
|
|
|
I have done it that way but according to samples I've found in Internet, it has to be possible to do it with overloading << but I cannot get it to compile.
|
|
|
|
|
Cristoff wrote: I've found in Internet
can i know this place ?
Cristoff wrote: but I cannot get it to compile.
any chance to have a look at your "not-compiling" code (i don't want it all, i need only a piece of code to understand how you try to achieve the point we're talking about) ...?
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20]
|
|
|
|
|
Thank you very much for wanting to help me. The problem is that I've deleted it yesterday and I cannot find it now, although I'm searching it yet for my own needs.
If I find it, I'll post it later.
Thank you!
|
|
|
|
|
I don't understand how varargs fits into overloading << ?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
|
VivekuniQ wrote: is it really possible to overload a ">>" ??
this is not what we're talking about, but to answer your prompt question, yes it is !!
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20]
|
|
|
|
|
#include "stdafx.h"
#include <string.h>
#include <iomanip.h>
#include <fstream.h>
#include <iostream.h>
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include <stdlib.h>
class Employer
{
friend ostream &operator <<(ostream &Obj, Employer &EmpObj) ;
private :
public:
Employer()
{
//strcpy(m_name,"Amol Ravatale");
}
~Employer()
{
}
char m_name[20];
};
ostream &operator <<(ostream &Obj, Employer &EmpObj)
{
Obj<<empobj.m_name ;
="" return="" obj="" ;
}
istream="" &operator="">>(istream &obj, Employer &EmpObj)
{
char str[30];
obj>>str;
strcpy(EmpObj.m_name ,str);
return obj;
}
int main(int argc, char**argv)
{
Employer emp;
ofstream man("amol.txt") ; //creates a text file in application path
strcpy(emp.m_name,"amol");
man<<emp; writes="" data="" to="" file
="" man.close()="" ;
="" cout<<emp.m_name="" ;="" shows="" at="" conssole
="" man="">>emp;
//cout<
|
|
|
|
|
sorry , include these files
#include "stdafx.h"
#include <string.h>
#include <iomanip.h>
#include <fstream.h>
#include <iostream.h>
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include <stdlib.h>
|
|
|
|
|
Here is basically what I'm trying to do:
<br />
#include <iostream><br />
#include <fstream><br />
<br />
<br />
class Logger<br />
{<br />
public:<br />
static Logger &GetInstance()<br />
{<br />
static Logger logger;<br />
return logger;<br />
};<br />
<br />
void Initialize()<br />
{<br />
if (!Log.is_open())<br />
Log.open("logfile.txt");<br />
};<br />
<br />
void Shutdown()<br />
{<br />
if (Log.is_open())<br />
{<br />
Log.close();<br />
}<br />
};<br />
<br />
<br />
<br />
protected:<br />
Logger()<br />
{<br />
};<br />
std::ofstream Log;<br />
<br />
public:<br />
template <typename T><br />
friend std::ostream & operator << ( std::ostream & os, T data );<br />
};<br />
<br />
template <typename T><br />
std::ostream & operator << ( std::ostream & os, T data )<br />
{<br />
os << data;<br />
std::cout << data;<br />
return os;<br />
};<br />
<br />
int main()<br />
{<br />
std::cout << "Hello world!" << std::endl;<br />
Logger::GetInstance();<br />
Logger::GetInstance().Initialize();<br />
Logger::GetInstance()<< "ciao" << std::endl;<br />
std::cout << "Good nigght world!" << std::endl;<br />
return 0;<br />
}<br />
<br />
...but unfortunately I don't know what I'm doing.
|
|
|
|
|
It seems that CP likes eating #includes... of course I use: fstream and iostream.
|
|
|
|
|
Iam using VC++ as a fonrtend software to communicate with embedded system
through Serial communication(RS-232). Iam using Readfile and Writefile
functions to read and write through COM port. Can anyone Clarify me the
following,
* Is it necessary to Flush the Input and Output buffer for every command
being transmitted/received ???
* If not, how often should i Flush the input and output buffer ???
Madhu
|
|
|
|
|
Hello.
I think you should flush the buffers after every Writefile. Else, chances are that the data will remain in the write buffer. When you do a flush, the data will be sent to the device.
There is (generally) no need for flush before Readfile.
You might considder to search for a serial class. There are several here at CP. I have found them very useful over the years.
Kakan
|
|
|
|
|
hi,
can anybody tell me how to open most recent documents?
|
|
|
|
|
jayshml wrote: can anybody tell me how to open most recent documents?
Search RECENT folder for most recently open Documents
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
double click on it.
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1"> --[V]--
|
|
|
|
|
VivekuniQ wrote: double click on it.
Where ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I want to control data in my Combobox so that, if data I write is not inside my combobox the cursor must stay in the control. If data became exact the cursor can go anywhere.
I don't know how to block the cursor and to release it on the control.
What to do ?
I learn my self
-- modified at 7:18 Tuesday 6th December, 2005
|
|
|
|
|
You will probably have to derive a class from your combo box class, and handle messages when the control loses focus (WM_KILLFOCUS ) or gets deactivated (WM_ACTIVATE ), and deny leaving the control depending on where the user wants to go (I do not know if you would like to block the focus within your application or for the whole system).
~RaGE();
|
|
|
|
|
I want that the cursor stay within this control (ComboBox) because the data I write is wrong.(It is not in its data property)
I learn my self
|
|
|
|