|
It was ofstream, i changed it to "wofstream myfile;" but it did't help
The data arrives over TCP, using WSABUF which i understand is actually of type char. Should i be able to write the data to file two bytes at a time so it could be opened?
|
|
|
|
|
yeah1000 wrote: The file wont open with openoffice and when i open it with notepad++ it displays some characters but most of them are NUL. What could be the problem?
For application to know that your file is a unicode one, the first two bytes of the file needs to be 0xff and 0xfe. If the first two bytes doesn't indicates any of the encoding codes, it will consider the file and ASCII file. I guess thats what happend in your case. Check http://en.wikipedia.org/wiki/Byte-order_mark[^] for more details.
|
|
|
|
|
Openoffice sometimes gives me the choice to choose in which format the file is, but when i select unicode then the file still is unreadable. Is there no way to write the file in binary format (as with binarywriter in c# for example) so that it wouldnt matter in which format it is?
|
|
|
|
|
yeah1000 wrote: (as with binarywriter in c# for example)
What difference does the file have when a string is written in c# using binary mode and in non binary mode?
|
|
|
|
|
Unicode aside, the only data that is going to exist in your file is DataBuf.buf[last_value_of_i] . You should probably be opening and closing the file outside of the for() loop.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Filemode is append, it does not help if i place it outside of the for cycle.
|
|
|
|
|
yeah1000 wrote: Filemode is append...
My bad. I overlooked that piece.
yeah1000 wrote: ...it does not help if i place it outside of the for cycle.
On the contrary, file I/O is very expensive (compared to reading from or writing to the file). If you are only writing a handful of bytes to the file, however, indeed it will never be noticed. For larger files, it's just plain wrong.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I am aware of that, i actually open and close the file far outside of the cycle, when i copied part of the code here i changed it to that. However, at the moment the problem is elsewhere.
Is it not necessary to define it somehow that i am using tchar? The buffer is in char format, if i write it to file byte by byte, at the end it should not matter that one char is actually 2 bytes in length, assuming that openoffice realizes that it is in unicode format?
|
|
|
|
|
yeah1000 wrote: However, at the moment the problem is elsewhere.
True, which is why I prefaced my initial comment as such.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
How to create shortcut in VC6? please!
|
|
|
|
|
See, for instance, "Shell Links" [^] topic at MSDN .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
gdctld wrote: How to create shortcut in VC6?
These[^] classes should do the job.
|
|
|
|
|
Hi, all
I want to do a windows service program with vs2008,
now, i want to know the steps to create windows service;
and i want to know the theory about windows service;
other,who can give a example?,hehe
|
|
|
|
|
|
Why don't you read MSDN doc about Services?!!!
There is everything, with plenty of complete samples !
|
|
|
|
|
Hi there-
How does one go about creating a virtual drive mounted in the OS?
What API's would one hook to to serve a virtual drive?
Thanks in advance.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
Hi,
WinCDEmu[^] is an open source disc emulating tool. See if that helps.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
i am in dire need of someone to teach me how to compile programs, from source codes, i have tried and tried to figure it out on my own and am having no luck, i am about to lose it guys, please help me, i am trying to use cygwin, edit plus3, visual studio c# 2008, and nmap i really need some help guys any would be very appriciated thanks.
|
|
|
|
|
Compiling a program is a very basic (and well documented) task.
For instance, using Cygwin environment, just type
g++ source-file-name
This works smoothly provided:
g++ coompiler is correctly installed.- (2) there is a source-file-name
C++ source file available.
I suggest you to choose your favourite compiler or IDE (this is an important step, for instance, I wouldn't use the C# compiler for compiling C++ source files... ) and read documentation about (help, tutorials, how to, 'even' a good book).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
thank you very much i will give it a shot.
|
|
|
|
|
ok i guess i am just a moron when it comes to this stuff, i am losing my mind i need step by step instructions i guess, everything i have found seems vague to me.. i used to mess around with this stuff back when 3.1 came out and 95 but i have lost all that i guess i just became lazy like most other people, the files i have for compiling the programs come in a tar.gz zip file and all the files end in like .c or .h i have no clue on what i am doing and your probably thinking wtf is this guy doing even attempting this..lol i guess i should just stick to building and modifying the hardware since i suck at the programs..
|
|
|
|
|
I need a connection avi or gif (multiple-frames) for my C++ program.
connection means client/server connection.
image size is around (100-300)x(50-250) pixels or similar.
It is too hard to find one from google.
Can you help to privide a link for download?
Thanks
|
|
|
|
|
includeh10 wrote: I need a connection avi or gif (multiple-frames) for my C++ program.
connection means client/server connection.
Do you mean a TCP client/server connection? What as it to do with AVI and animated GIF (i.e. have you special needs?)?
includeh10 wrote: Can you help to privide a link for download?
Well you're a software developer, aren't you? Have a look at [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
/*-----*//* the device context dc must still exist when the pen/etc is deleted */
class PEN{public: HDC d; HPEN pen,old; PEN(HDC dc,COLORREF col); ~PEN();};
PEN::PEN(HDC dc,COLORREF col){d=dc; pen=CreatePen(0,1,col); old=(HPEN)SelectObject(dc,pen);};
PEN::~PEN(){SelectObject(d,old); DeleteObject(pen);};
/*-----*/
class FONT{public: HDC d; HFONT font,old; FONT(HDC dc,HFONT f); ~FONT();};
FONT::FONT(HDC dc,HFONT f){d=dc; font=f; old=(HFONT)SelectObject(dc,font);};
FONT::~FONT(){SelectObject(d,old);};
/*-----*/
class TEXTCOLOR{public: HDC d; COLORREF col,old; TEXTCOLOR(HDC dc,COLORREF F); ~TEXTCOLOR();};
TEXTCOLOR::TEXTCOLOR(HDC dc,COLORREF c){d=dc; old=SetTextColor(dc,c);};
TEXTCOLOR::~TEXTCOLOR(){SetTextColor(d,old);};
/*-----*//* only declare one PEN and one FONT and one TEXTCOLOR in the same { } block */
Example of use:
{TEXTCOLOR brktlevel(dc,RGB((P->error&2)?255 ,0,0));
P->scrline=displ*CH;
scritem[displ&0xff]=P;
show(dc,L);
}
|
|
|
|
|