|
Eranga Thennakoon wrote: ::memcpy(tmpBuffer, &iReq, 4);
::memcpy(tmpBuffer, &strGetName, 6);
These two statements are writing to the same location. The second one needs to write four bytes past the starting address of tmpBuffer , like.
memcpy(tmpBuffer, &iReq, 4);
memcpy(tmpBuffer+4, strGetName, 6);
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes my code overwriting the buffer. Any way pointing the buffer make correction to me, as on my second post. It is ok, right....
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: Any way pointing the buffer make correction to me, as on my second post. It is ok, right....
I've no idea what you are saying here.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I am porting bc3.1 code to VC++.Net. While compiling i am getting the above error in the below line
extern char MC_320_ATP[];
this is in header file and the cpp file contains
char MC_320_ATP[] = "\n#DIR A320\n 4.2 Micro Computer Test %02d.%02d.%04d %02d:%
02d:%02d";
Thanks for your help
Regards
|
|
|
|
|
subramanyeswari wrote: "\n#DIR A320\n 4.2 Micro Computer Test %02d.%02d.%04d %02d:%
is there a specific reason that there is a newline after this? or has is just been introduced while pasting the code here?
|
|
|
|
|
For the newline only. It is not from the copy and paste.
|
|
|
|
|
in that case can try removing it or putting a \ at the end, ie:
char MC_320_ATP[] = "\n#DIR A320\n 4.2 Micro Computer Test %02d.%02d.%04d %02d:% \<br />
02d:%02d";
|
|
|
|
|
I tried both. It didn't work
|
|
|
|
|
It is showing error in the header file not in the cpp file
|
|
|
|
|
then the error probably lies in the lines above extern char MC_320_ATP[]; , check those...
|
|
|
|
|
Hello,
extern const char* MC_320_ATP[]
const char* MC_320_ATP[]
Hope this helps.
Bekir.
|
|
|
|
|
this also didn't work. Any other solutions
|
|
|
|
|
If the error is happening in the .H file, then the string won;t matter. But the new line rings alarm bells for me. Try making sure all the text is on one line.
Also try using
extern const char *MC_320_API;
instead.
(Both those have been suggested).
Also suggested, but I haven't seen you reply to it...
The problem might not even be on that line of code - it could be higher.
Try commenting out the line, and see if the problem goes away, or if it moves to the next line.
If it moves, then the problem was "bad" code higher up.
(and yes, if you comment out the extern, you will have errors in your cpp files - this is just a test).
Iain.
|
|
|
|
|
thank you all. I figured it out. I missed a semi colon in the previous included header file.
Regards
|
|
|
|
|
I would like to build a list control with first column used as a “horizontal header"”.
With the first column locked in place the rest of the columns should scroll horizontally as in "standard" list control.
Any suggestions how to do this?
Thanks for reading
Cheers
Vaclav
|
|
|
|
|
Vaclav_Sal wrote: With the first column locked in place...
Meaning that you don't want it to be sizeable?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: Meaning that you don't want it to be sizeable?
Or even non-clickable (to sort)?
Maxwell Chen
|
|
|
|
|
Yes, sorting is not necessary in my case.
|
|
|
|
|
Not really, but it can be fixed size if necessary.
I just want to have horizontal reference same as current vertical header is.
For example – if the first column is an "Index" I want to see this column regardless of horizontal scroll position - for easy reference.
I think Lotus 123 used something like that. I have not found it in Excel – not yet.
|
|
|
|
|
Vaclav_Sal wrote: For example – if the first column is an "Index" I want to see this column regardless of horizontal scroll position - for easy reference.
Understood. I know of no way to do this with a stock control. You might have to resort to two separate controls.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I can't think of any way as such...
But you could always find a solution by changing the problem.
Look at grid controls, either C Maunders classic Grid Control, or the Ultimate Toolbox one.
I found the "Ultimate Toolbox" one a bit of a fiddle to start with, but I think it's more powerful in the end.
(I used the old CGridCtrl before, and have no great need to suffer to change)
Iain.
|
|
|
|
|
It is a good idea - use two controls "married" to each other.
It may even work better allowing any column to be used as a horizontal header. I'll give it a shot. Of course I need it in CListView which may complicate things a little.
Thanks guys and girls!
May 2008 be a good one for all of you.
Vaclav
|
|
|
|
|
I generally use what MSDN calls CRT lowlevel file I/O functions. These are the ones defined in io.h and fcntl.h; open, lseeki64, telli64, close, etc... There doesn't seem to be a function to allocate filespace quickly. For this example I would want to create a 10MB file. If I write 10485760 \0's to the file, it will obviously make the file 10MB - however it is slow (well for LARGE files).
I did experiment by using the following code on winvista 32-bit.
<br />
char c = 0;<br />
int newfile = open("newfile", _O_WRONLY | _O_BINARY | _O_TRUNC | _O_CREAT, _S_IREAD | _S_IWRITE);<br />
lseeki64(newfile, 10485759, SEEK_SET);
write(newfile, &c, 1);
close(newfile);<br />
This seemed to do the trick, and the resulting 10MB file was \0 filled. However, I didn't think you were allowed to seek past the end of a file with lseek. Is this behavior expected to work on all OSs, or will some have an error with the seek? Is there any better way to do it? Basically what I am trying to accomplish is telling the OS that I am going to need X amount of disk space BEFORE I start writing the actual data, without taking up much time. The files are usually around 8GB, but may be even larger than that. My goal is to minimize fragmentation and the possibility of running out of disk space unexpectedly in the middle of writing to the file.
Finally, the contents of the allocated file are unimportant and don't have to be \0 filled (i.e. garbage is ok), but will this way or an alternative guarantee \0 filling?
|
|
|
|
|
The only constraint I see with lseeki64() is that you can't position the offset before the beginning of the file. Another option would be to try SetFilePointer() and SetEndOfFile() ?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Would GetDiskFreeSpaceEx or similar do the trick?
I am not sure if your concern about fragmenting the disk is necessary.
Why do you want to second guess the OS? Just my opinion of course.
Vaclav
|
|
|
|