|
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
|
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
|
I could use some very basic assistance solving this problem.
The struct is located inside class function and I am not sure if that is OK.
I am trying to port C code to C++.
Here is the error
I get same error for both test calls to malloc
../src/MODULES/M_BLUEZ/CBLUEZ.cpp:505:14: error: invalid conversion from ‘void*’ to ‘hci_dev_list_req*’ [-fpermissive]
dl = malloc(HCI_MAX_DEV * sizeof(*dr) + sizeof(*dl));
Here is the offending code snippet
<pre> struct hci_dev_list_req *dl;
struct hci_dev_req *dr;
int dev_id = -1;
int i, sk, err = 0;
dl = malloc(HCI_MAX_DEV * sizeof(*dr) + sizeof(*dl));
if (!dl) {
err = errno;
goto done;
}
dl = malloc(HCI_MAX_DEV * sizeof(struct hci_dev_req) + sizeof(uint16_t));
Thanks
Cheers
|
|
|
|
|
Since malloc can only return a void* , it must be cast to the receiving type:
dl = reinterpret_cast<hci_dev_list_req>(malloc(HCI_MAX_DEV * sizeof(*dr) + sizeof(*dl)));
|
|
|
|
|
Thanks,
just figured that out.
Appreciate your reply anyway.
Is it more appropriate to do reinterpret_cast<hci_dev_list_req> or just
(hci_dev_list_req*) ?
|
|
|
|
|
Since you are "porting C code to C++", why don't you replace malloc/free with the new/delete?
Just use C++ allocation operators/methods and you won't need every time cast the returned pointer to the correct type.
|
|
|
|
|
I was going to suggest the use of new, but since he is allocating a single area for two separate structures it would be more complicated.
|
|
|
|
|
In C++ it is more appropriate to use reinterpret_cast .
|
|
|
|
|
Richard
I knew it had something to do with storage when I looked at cb it was only 4096 bytes 0XFFE
Had a global counter count the number of bytes I uploaded it was 0X16F67A I set LimiText to 0x16f770 and was able to type in the Rich Edit Control
Thanks
|
|
|
|
|
If this is meant as a response to a problem reeported somewhere on this site, please use the appropriate links to post a comment/reply/solution right there, not in some random forum!
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
It’s the thread immediately below.
|
|
|
|
|
I streamed in text into a rich edit control To make it align I set SetDefaultCharFormat to Courier New the ES_READONLY flag is not in resource definition file for this control is there an way to modify the text
Thanks
|
|
|
|
|
Your post is somewhat unclear. Please explain in more detail what the problem is with modifying the text of an edit control.
|
|
|
|
|
Let me be specific I am writing a debugger and stream in the program listing. On the left hand side I have a one byte area for the user to in put a command like ‘B’ for breakpoint
Thanks
|
|
|
|
|
Very interesting, in a non-specific way. I am sure you do have a specific question, but I have no idea what it is.
|
|
|
|
|
I stream in the program TEXT from the Z/OS Assembler SYSADATA I then did SEL(0,-1) and changes it to RTF Courier New before displaying it, I would like to enter text
for example here is a line "_ 204 00004A LA R4,QDINIT " Where the Hyhpen is I would like to let the user enter a letter "B' but the entire text is protected
I have been doing research and it seems with the setevnetmask with a notification for a change I would get an en_chnage message and the doc says it I return 0 another message gets sent I am wondering if I
process this message would be able get to set the text modify (for example the B) it. Don't know if I am on the right track with this. All I really want to do is let the user enter text in this now RTF
richedit this should be possible after all Word is an RTF editor and you can modify the text even if its Rich Text (formatted with fonts)
Thanks
|
|
|
|
|
No idea what is happening there. I have used RichEdit controls and never had such a problem. Try a straightforward RichEdit control and don’t do anything to modify its settings to see what happens.
|
|
|
|
|
thanks that's all I was looking for from the way you see it I should be able to modify the text, I did a SetWindowText to the Richedit e.g. this is a test message and was able to type in it the rich edit control
thanks for your help if from the way you see it I should be able to modify the text Ill research the problem
|
|
|
|
|
Hi ,
can u please help me to read XLSX file without office automation
i read XLS file using ODBC Driver.
but XLSX file read by this driver not found please help me how can do this.
thanks for any help and guidance in advance
|
|
|
|
|
|
|
thanks for reply
but i want to ask one thing these .Net dll can use in my mfc VC++ application.
|
|
|
|
|
Whoops! Sorry, I thought this was a C# question.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
its ok plz provide me any help for my mfc vc++ application
|
|
|
|
|
In the past for just basic files I have used
GitHub - brechtsanders/xlsxio: XLSX I/O - C library for reading and writing .xlsx files[^]
Note the 3 limitations
1.) assumes the first row contains header names
2.) assumes the next rows contain values in the same columns as where the header names are supplied
3.) only values are processed, anything else is ignored (formulas, layout, graphics, charts, ...)
CSV has easily become the more normal interchange and as its as simple as "save as" in excel it's rare anyone bothers with raw excel file anymore. They can do all there fancy graphs etc in excel itself and just export the data
In vino veritas
|
|
|
|