|
i think you problem may come from you write in a buffer not large enough.
do this :
1. get the number of characters in the file to be exctracted.
2. allocate your buffer with that number of bytes.
3. read() the totality of the file ; it will never overflow the buffer (considering the memory is correctly allocated)
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
Amarelia wrote: ...it terminates when it gets some character...
Is it encountering an EOF character? If so, you need to open the file as binary, not text.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Hello,
Can anyone send me a link to a c++ sample that is able to track all pages sent to a local or network printer from a machine (running Windows XP)?
Thank you,
Regards,
Dan.
|
|
|
|
|
Start here.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
|
I think micutzu would benefit more from this suggestion.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Thank you very much for your comments. I will read both articles and I hope it will help me.
Best Regards,
micutzu.
|
|
|
|
|
In MDI,I want a child window with some text from Main window menu list and also from tool bar?
|
|
|
|
|
|
i run in a very strange c++ compiler problem.
until now i used the definition 'id' which gave me the right value ( = 0x00006964 ).
because i compile under window, mac and linux and the mac gcc compiler complains about wrong 4-byte-characters i added '\0\0id' to the definition which should give in my opinion the same result. but the vc++ and intel c++ compiler generates other values.
'id' = 0x00006964
'\0\0id' = 0x64690000
' id' = 0x20206964
'\40\40id' = 0x64692020
the most interesting things are the last 2 lines. what is the difference between a space written as space or as a esc-character? ... why does the compiler generates swapped values?
that doesn't makes sense to me ... any hints would be great ...
thanks
tilo
|
|
|
|
|
|
it's not the byteorder why i'm surprised. i'm confused because the 3rd line gives another byteorder than the 4th line with the same compiler and machine ...
tilo
|
|
|
|
|
|
e.g.
#define ANY_ID_1 'id' // gives the warning under gcc mac
#define ANY_ID_2 ' id' // gives the same byteorder like 'id'
#define ANY_ID_3 '\0\0id' // has the wrong byteorder
i use the defines as longs ...
cheers
tilo
|
|
|
|
|
the compiler is probably treating '\40\40id' as a numeric literal (which causes the machine's byte-order rules for numerics to get involved).
it probably sees ' id' as a string literal (even though you shouldn't put multiple characters inside single quotes), and ends up doing something like:
char *p = " id";
long f = *(long*)p;
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
hmmm ... strange things happens ...
i tried this one here ...
char *p = "\0\0id";
long f = *(long*)p;
if running this code f results in 0x64690000 ... that's exactly the same what the compiler generates with the constant '\0\0id' .. and that's swapped compared to 'id' which results in 0x00006964 ?!?!?!?!
this is one of the days where i don't understand compilers ... i want that the compiler generates the same constant when i write 'id' and '\0\0id' because this is obviously the same (for me!)
cheers
tilo
|
|
|
|
|
bytefactory wrote: i want that the compiler generates the same constant when i write 'id' and '\0\0id' because this is obviously the same (for me!)
how about:
long f = (0x00) << 24 | (0x00 << 16) | (0x69 << 8) | 0x64;
?
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
that would work but make a lot of work at another place in the program because i use the includefiles are parsed with an own scripting language that understands only 'xxxx' and numbers
thanks for the suggestion ...
tilo
|
|
|
|
|
This is just a shot into the blue, but isn't Unicode basically not a system type? Like, int would be "swapped" on little endian/big endian" but unicode would be the exact same binary pattern?
I remember being lectured on something like that, but I might be way off here.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
How to create a new window(child window) from menu list...and also from toolbar?
|
|
|
|
|
I did'nt get your question..Please add more information
|
|
|
|
|
what is a window ?
i give you the example for a new dialog box. if you want something else, make the conversion.
when you click on a toolbar button, on on a menu item, handle the WM_COMMAND event that is thrown, and overload it :
void OnSClickMenuAbout() {
CAboutDlg dlg;
dlg.DoModal();
}
(here i consider you open the "About" DialogBox on clicking its item in the menu...)
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
Anu_Bala wrote: (child window)
may be she must be talking about MDI.
"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]--
|
|
|
|
|
i only gave an example...
the
CAboutDlg dlg; line can be replaced with something like :
CChildFrame frm(this); where this is the parent for instance...
i hope the guy can search for infos by himself, and not waiting for everything well done and well written, until he just have to copy/paste the solution in his code...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
hmmmm
OT:How was your holidays buddy?
"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]--
|
|
|
|