|
thx it run's.
|
|
|
|
|
I get this error:
'__thiscall CFile::CFile(const char *,unsigned int)' : cannot convert parameter 1 from 'const char *(void) const' to 'const char *'
when I try to do :
CFile filePort(m_outputFileName[0].c_str, CFile::modeRead);
m_outputFileName[0] is a std::string.
Will I have to strcpy m_outputFileName[0] into a char temp[256] and put that into CFile?
I'm not sure how to make the std::string behave for the CFile. Is there a simpler way?
Thanks,
sb
Added:
I get the same error if I do:
char file1[256];
strncpy ( file1, m_outputFileName[0].c_str, 256);
|
|
|
|
|
c_str()
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Aaargh! Havent dealt with std::strings much....thats my poor excuse.
Thanks so very much,
sb
|
|
|
|
|
Hi Guys,
How Can I convert a CString to a T_String.
My T_String is a typedef defined as follows.
typedef std::wstring T_String;//wstring,co's my project is unicode defined.
Thanks......
|
|
|
|
|
Just curious....
Why are you doing that? CString has already unicode support.
Jaime
|
|
|
|
|
co's I have a function which takes a T_String as parameter...
|
|
|
|
|
since CString (when UNICODE is defined) and std::wstring both are defined as an array of wchar, you could safely do:
CString sOther = _T("This is a string");
T_String s = (LPCTSTR)sOther;
Jaime
|
|
|
|
|
|
I am searchinf for information about NFS protocol. Do you know any useful link or samle ? Thanks. Satucha
|
|
|
|
|
Start here.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
hi all,
anyone konws the win32 api for knowing that who is the current logged in user? I need it for only windows nt based OSes i.e. nt, 2000, xp
thanks in advance
|
|
|
|
|
Check out the MSDN documentation for the
NetQueryDisplayInformation() API
|
|
|
|
|
thanks.
Can you tell me also any win32 API to copy a file from a folder to another folder?
thanks again.
|
|
|
|
|
Try CopyFile() , MoveFile() , SHFileOperation() , or the CFile class.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
sorry, i found the api to be CopyFile()
|
|
|
|
|
You'll want to use NetWkstaUserGetInfo() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
How can I make this (test_26_tt1) variable global;
typedef struct <br />
{<br />
unsigned short data; <br />
unsigned 4 : count<br />
unsigned 1 : fault<br />
unsigned 2 : err <br />
}TEST_26_TT1
union<br />
{<br />
TEST_26_TT1 message_data;<br />
unsigned short buffer[32];<br />
}test_26_tt1;
If it was a float then I could do
// Globally declare the variable in just before the Main section of the code
float flt1;
extern float flt1; // This would allow global use in another unit of the program.
Or should type type of data be wrapped up in a class; as they are many.
|
|
|
|
|
what problem did you have when you used the same way as float?
Jaime
|
|
|
|
|
No problem with the float;
Just do
extern float flt1;
in any units you want to use it.
My problem is with the union, how do I reference it in another unit?
extern <type=????> test_26_tt1;
I have lots of bit fields which I form into a buffer via the union (same memory, but two names).
|
|
|
|
|
the question I did was not for the float, but for the test_26_tt1. What problem did you have with it? Variable isn'r recognize? did you receive a compilation error?
Jaime
|
|
|
|
|
When you form a union you can now use the data. i.e. two variables have been declared.
union<br />
{<br />
TEST_26_TT1 message_data;<br />
unsigned short buffer[32];<br />
}test_26_tt1;
in the code you can do the following:-
test_26_tt1.buffer[3] = 0xFF;
My question was how do you refer to this data in another unit using the extern
If I use the statement
extern test_26_tt1;
and refer to it as
unsigned short x = test_26_tt1.buffer[2]; in another unit I get the error:-
c:\Example\Database.cpp(101): error C2228: left of '.buffer' must have class/struct/union type.
Its a question of type, as I said with float
extern float flt1;
extern ???? test_26_tt1;
|
|
|
|
|
You haven't created a variable yet, just a type
extern TEST_26_tt1 my_global_variable;
The extern is sometimes optional, but the same rules apply as for float.
|
|
|
|
|
When you form a union you have declared a variable; i.e.
// Form a union between the message structure and a buffer
union<br />
{<br />
TEST_26_TT1 message_data;<br />
unsigned short buffer[32];<br />
}test_26_tt1; in the code you can do the following:-
test_26_tt1.buffer[3] = 0xFF;
But how do you use the variable test_26_tt1 in another unit.
With a float you can use:
extern float flt;
But how do you do the same with test_26_tt1.
<br />
extern ???? test_26_tt1;
What type do you use.
grahamfff
|
|
|
|
|
I had to look up union again...
I think
extern union
{
TEST_26_TT1 message_data;
unsigned short buffer[32];
} test_26_tt1;
will work. Or make your union a full type like this:
union test_26_union
{
TEST_26_TT1 message_data;
unsigned short buffer[32];
}
extern test_26_union test_26_tt1;
Depending on if you want to use this union elsewhere.
Let me know what works, I've never used unions in C++, but I can think of a few times where it might be useful.
|
|
|
|