|
christophek wrote:
Note: yes the filepaths need to be WIDECHARS
The 'basic_ofstream' template behind wofstream takes 'const char*' form of file name. ie, if you want to write wide chars to a file also, still you have to give the file name in ordinary char form while opening it.
christophek wrote:
std::wofstream outfile (_wfopen(out,L"a"));
There is no overloaded constructor for basic_ofstream which takes FILE* returned by _wfopen().
christophek wrote:
buffer = new wchar_t ;
you missed to give the buffer size required.
suhredayan There is no spoon.
|
|
|
|
|
right, it should be buffer = new wchar_t [size]; (the forum mispasted this)
But I don't want to write wide chars to a file, I just want to open a file with a widechar filepath and copy the content to another file also with a widechar filepath
|
|
|
|
|
christophek wrote:
But I don't want to write wide chars to a file, I just want to open a file with a widechar filepath and copy the content to another file also with a widechar filepath
No, there is no way in c++ to pass wide character file names to fstream. However you can use WideCharToMultiByte() to convert your wide char file name before passing to fstream.
suhredayan There is no spoon.
|
|
|
|
|
I'm printing a drawing, which has about 50,000 elements(lines and arcs). The steps is as follows,
1.Create a printer DC;
2.StartDoc(), StartPage();
3.Set mapping mode;
4.loop to draw lines and arcs;
5.EndPage(), EndDoc()
6.Delete printer DC;
The output devices are "HP LaserJet 5000 PCL 6"(max paper size A3), and "HP DesignJet 750C"(max paper size A0).
The problem is, because of so many objects, when the data have been sent to the printer, it will take a long time (several minutes) for the printer to process data before actually printing (the printer's LCD shows: processing data...).
I had try to use bitmap printing, that is, first draw elements to a bitmap, then BitBlt the bitmap to printer DC. But I'm afraid it will be failed to create a bitmap if user select a large paper such as A0.
|
|
|
|
|
Hi all,
Since recently defining WINVER as 0x0500 in a recent project, I get the following compiler messages when building the app:
"NOTE: WINVER has been defined as 0x0500 or greater which enables
Windows NT 5.0 and Windows 98 features. When these headers were released,
Windows NT 5.0 beta 1 and Windows 98 beta 2.1 were the current versions.
For this release when WINVER is defined as 0x0500 or greater, you can only
build beta or test applications. To build a retail application,
set WINVER to 0x0400 or visit http://www.microsoft.com/msdn/sdk
to see if retail Windows NT 5.0 or Windows 98 headers are available.
See the SDK release notes for more information."
This link is no longer valid.
Thanks for any help!
|
|
|
|
|
|
|
Hi all,
I have some code that uses RAS/DUN connections, and I am also using code that uses RegisterDeviceNoticication(). In order to use the API UnregisterDeviceNotification() to close the handle returned by the first function, WINVER must be defined as 0x0500 or greater. After doing this, my RAS functions return error 632 -- "An incorrect structure size was detected."
Specifically, I'm getting this error when trying to use RasGetEntryProperties get get info into a RASENTRY struct.
What's the deal here?
I'm using WinXP, & MS VC++ 6.0 w/ SP 6 installed.
How can I fix this?
|
|
|
|
|
Hi,
I want to print a chart, that is drawn in a dialog. I have no idea how to do that. should i use the function Print?
thanks in advance
|
|
|
|
|
|
What would the following conditional (i+n) in a for loop evaluate to?
for (i=0; i + n; i--)
I saw it once, but I dont understand what was happening.
Did I post well? Rate it! Did I post badly? Rate that too!
|
|
|
|
|
0 if n starts at 0. Otherwise non-zero, thus the for loop would never terminate.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I want to believe you, but I cannot.
int k = 0;
int i, n=100;
for (i=0; i + n; i--)
k++;
When this is done, k will equal 100. Can you explain?
Did I post well? Rate it! Did I post badly? Rate that too!
|
|
|
|
|
The for test is:
i + n
which is the same as:
i + n != 0
n = 100 so we can rewrite as:
i + 100 != 0
or (subtract 100 from both sides),
i != -100
so as i starts at 0 and decrements by 1 on each iteration it will loop 100 times.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
It helps to show all of the code up front. Since n starts out as 100 , rather than 0 as I initially presumed, i + n will eventually evaluate to 0 which will terminate the loop.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Surely if n was -1 it would not evaluate to 1, but to zero, so the for loop would not loop forever?
|
|
|
|
|
In the code snippet provided by Esmo2000, when does n ever equal -1?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I hadn't seen that response yet
|
|
|
|
|
in C/C++, booleans can be reprensented the following way :
0 equals to <code>false</code>
any other values different from 0 equals to <code>true</code>
so, as (i + n) would equal to 100, it is true - until it become equals to 0...
you follow me ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
for n < 0 the loop will execute until i wraps around to abs(n)
for n == 0 the loop will never execute (i+0) == 0 == false
for n > 0 the loop will execute n times
|
|
|
|
|
Hi all///
I used a English dictionary program that can explain meaning of the word when i press ctrl + click right mouse on the word in any windows such as notepad,internet explorer,word...>>>i tried to code one same program but i didn't know how to get text of other windows as that program did.
please help me///
thanks
Here we go!!!
|
|
|
|
|
One way is to use the IAccessible interface, specifically the get_accValue() method.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi, I'm trying to write a basic Battleship game that can be played over the internet VIA a socket client/server set up.
I'm using MFC.
When the user clicks a button, it sends a message to the server where they clicked, the server then relays that on to the client. When the client receives it, they send a message back if it was a hit, or miss.
I have a thread that runs to get messages from the server, so I can have a chat running at the same time. So when the thread for receiving server messages gets a message back telling them if their shot was a hit or miss, I want to update the status of the buttons that I use for showing moves, by changing the forecolor of the button.
the code i use is --
<br />
the type of button is: CCommandButton : CWnd (Which is used as a wrapper for the ActiveX command button)<br />
CCommandButton l_Buttons[10][10];<br />
then inside of my server message thread i use the code:
<br />
l_Buttons[0][0].put_BackColor(0x0000FF);
I can put that same code into a non-threaded function and it works exactly how I want it to.
Is there any way I can fix this?
Thank you!
|
|
|
|
|
This sounds like a race condition, a common problem when multiple threads are involved.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I think I am going to end up using two ports on my program. One for server messages and one for chat. Hopefully that'll fix it.
|
|
|
|