|
George_George wrote: ...I want to use the preferred function independent of whether UNICODE or _UNICODE is defined.
Hence my suggestion to use _tfopen() .
George_George wrote: For example, when UNICODE is defined, I want to use fopen.
Which is exactly what happens. Check the preprocessor output, and you'll notice that fopen() is being used.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks David,
How to check preprocessor output in Visual Studio 2003?
regards,
George
|
|
|
|
|
George_George wrote: How to check preprocessor output in Visual Studio 2003?
See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes, your understanding is correct. However, these things are taken care by "Using Generic-Text Mappings". For example, if you use _tfopen (Generic-text routine name) and if SBCS (_UNICODE & MBCS Not Defined) then it will convert as fopen, if MBCS defined - fopen and if UNICODE defined - _wfopen.
Please refer http://msdn2.microsoft.com/en-us/library/7dzey6h6(VS.80).aspx[^] for more information.
Regards,
Paresh.
|
|
|
|
|
Thanks Paresh,
I want to confirm that, for any Windows platform, no matter whether UNICODE or _UNICODE is defined, we could invoke fopen and wfopen freely. Right?
For example, when UNICODE or _UNICODE is defined, we could still use fopen and pass multibyte encoded characters. Right?
regards,
George
|
|
|
|
|
FILE *fopen( const char *filename, const char *mode );<br />
FILE *_wfopen( const wchar_t *filename, const wchar_t *mode );
The fopen function opens the file specified by filename. _wfopen is a wide-character version of fopen; the arguments to _wfopen are wide-character strings. _wfopen and fopen behave identically otherwise.
If the symbol _UNICODE is defined for your program, parameter "filename" is of type pointer to wchar_t, a 16-bit character type; otherwise, it is of type pointer to char, the normal 8-bit character type.
Please refer below websites for more information,
http://www.i18nguy.com/unicode/c-unicode.html[^]
http://msdn2.microsoft.com/en-us/library/yeby3zcb(VS.80).aspx[^] - Look at "Generic-Text Routine Mappings".
Regards,
Paresh.
|
|
|
|
|
Thanks Paresh,
I think I can use fopen even if I defined UNICODE, and pass parameter in multibyte character, right?
regards,
George
|
|
|
|
|
I've the following problem:
the client invokes some functions on the server side, which takes a lot of time (a few minutes) to answer. I believe it depends on the timeout. How can I put it up?
I've the following exception:
"Caught exception:
Type: class RCF::Exception
What: [30: client read timed out][0: No sub system][0: ][What: ][Context: ..\rcf-09c\src\rcf\TcpClientTransport.cpp(275): void __thiscall RCF::TcpClientTransport::bsdRecv(const class RCF::ByteBuffer &,__w64 unsigned int): : Thread-id=688 : Timestamp(ms)=41594734: THROW : class RCF::Exception : [30: client read timed out][0: No sub system][0: ][What: ][Context: ]: bytesToRead=4,..."
Many thanks,
Daria
|
|
|
|
|
Does anyone know of a C++ equivalent (preferably *not* MFC) of .Net's FileSystemWatcher?
[edit] never mind, after a bit more searching, I stumbled upon this [^][/edit]
Last modified: 12mins after originally posted --
|
|
|
|
|
Hi
I'm getting streaming data to the program I'm writing and I need to update the data constantly. I'm currently just doing a switch statement to determine what needs to be updated and then after the switch I have UpdateData(false); This works but it will not allow me to enter values into over boxes in the display as it is constantly being updated. Is there a way to update just the single box value and not the whole display?
Thanks
Simon
|
|
|
|
|
simoncoul wrote: Is there a way to update just the single box value and not the whole display?
Sure, just use ClassWizard (Ctrl+W) to assign a control variable to each control on the dialog. For edit, static, and button controls, use SetWindowText() . For listboxes and comboboxes, use AddString() .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hey thanks for the quick reply, but the SetWindowText asks for a LPCTSTR as the argument but I need to do integers and sometimes floats. Can I just cast it?
Thanks again
|
|
|
|
|
There are functions for appropriate conversion, for example itoa, ltoa.
Or, if you are using CString:
long var =12345;
CString strVar;
strVar.Format( "%d", var );
MS
|
|
|
|
|
simoncoul wrote: Can I just cast it?
No. Use:
char szData[16];
int nValue = 12345;
sprintf(szData, "%d", nValue);
...
double dValue = 987.01;
sprintf(szData, "%f", dValue); By chance are you using MFC?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes I am, does that make this easier?
|
|
|
|
|
simoncoul wrote: does that make this easier?
Not necessarily easier, but slightly more elegant and efficient:
CString strData;
int nValue = 12345;
strData.Format("%d", nValue);
...
double dValue = 987.01;
strData.Format("%f", dValue);
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks for all the help guys!
|
|
|
|
|
simoncoul wrote: Can I just cast it?
No.
There is a routine you cann add to yotu program called boost::lexical_cast[^] which allows you to use a simple cast.
(The documentation even describes what is going on under the hood)
double pi = 3.14;
std::string number = boost::lexical_cast<std::string>( pi);
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
can anybody tell me how to read the data from a .cvs file to an array
|
|
|
|
|
use CStdioFile to read the text lines from the file and strtok to split and extract each value from the text line.
|
|
|
|
|
Would you be so kind as to tell us what a .cvs file is? Short of that, the best you could hope for would be a rather vague solution.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
a ".cvs" file is a comma sepereated values file(.CSV). The file is comma delimited. You can store data such as Justin, James, Perez and save the file, and load it into Excel and it will put them into a table for you.
Or maybe you were being sarcastic
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Of course I know what a .csv file is! My question pertained to .cvs files.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I assumed it was a typo by the OP. Jokes on me a guess
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
csv stand for Comma seperated value
|
|
|
|