No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
63 Posted Topics
Has anyone ever gotten an error saying "the specified file is an unrecognized or unsupported binary format" in regards to starting a library? | |
This is a general question. I am familiar with accessors and mutators (getters and setters). I have now been reading up on semaphores. I am having trouble finding out differences between them/how they are related. Can anyone help me out with an explaination or a link? Thanks. P.S. - sorry … | |
Does anyone know how to delare a managed class in unmanaged code? This is driving me nuts, because I can call unmanaged from managed, but not the other way. Is there a way to do this? Thanks in advance. I want this for example: class foo { public: //other code … | |
I have a struct. I want to declare a pointer to that struct. Now I want 10 of those structs. How is this declared? I have tried (call the struct foo for example): foo* test[10]; when I make a call to test[0]->whatever or test[5]->whatever it seems to always write to … | |
I have an vs2005 forms application running a thread to constantly try and receive data via ethernet. My problem is once I get the data I want to pass it up through some object oriented layers. When I try to make a call to one of the layers sampleLayer->blah(); I … | |
would this be a spot to post a microcontroller related wiring question? | |
Is keil software for programming microcontrollers a free tool, or does it need to be purchased with a license? Thanks. | |
I am writing to a text file. Everything is working fine, except I can not figure out how to start a newline. I have tried fprintf(txtFile, "%s", "\n"); fprintf(txtFile, "%s", '\n'); fprintf(txtFile, "%s\n", " "); where txtFile is my FILE handle. How do I create a newline? Thanks. | |
I have a buffer of chars. I want to display them in a text box as hex. is there a simple way to do this? Thanks. | |
I want to delete a bitmap. How do I do this in c++. DestBitmap->Save("TempImage2.bmp"); . . . . . //later something like Delete("TempImage2.bmp"); is there a way to do this. thanks, nemo | |
I am drawing on a bit my, then re-loading the bitmap(to erase it) then drawing on it again at 100Hz. I am getting flicker. Is there a way to reduce this flicker? Or a better way to do this than to reload the bitmap everytime? Thanks. | |
How do you draw on an image in visual studio 2005 and get it to stay? Ive can get it to draw, but it flickers on resize and disappears when the resize is done. Any ideas? | |
How would one seperate a decimal into 2 numbers, the left and right sides of the decimal? float example = 131.14567 into... int left = 131 float right = .14567 thanks. | |
I am attempting to read a text file. [CODE] ifstream indata; indata.open(filename); if(!indata) { // file couldn't be opened } else { // file opened } // keep reading until end-of-file string data; while (getline(indata, data)) { //this is where i want to store values } indata.close();[/CODE] I want to … | |
I am current working on developing software in SUSE 10.2. The program works correctly, and then i statically compile it and run in DamnSmallLinux, and as soon as the program runs i get the 'set_thread_are failed when setting up thread-local storage area' error. I also tried to put the files … | |
Does anyone know if vs2005 has the borland equivilent of a "scrollbox"? Thanks. | |
I am trying to run a simple program to read ethernet using UDP. Here is the code, but it always receives -1 for 'error', but I did it by the book. Do you guys see the problem? Thanks. [CODE]//enum specifying the current status of the comm port. enum e_PortStatus { … | |
When can you determine if you are using too many threads? Assuming I have complete control and mutex locks and what not, when does it slow my program down, rather than speed it up by splitting up processing into sectons and passing between FIFO queues. Thanks. | |
I am running a thread that does something, then sleeps for a while. If the program closes it continues to sleep to completion. How do I get it to abort immediatly, even if in the middle of sleeping? [CODE]void commThread::ThreadEntryPoint1() { while(1) { //do work Sleep(15000); //15 second sleep } … | |
I am attempting to use a queue. I am doing it just like an example i read. I am doing a vs2005 form applicaiton. [CODE]#pragma once #include <queue> public ref class DataSource { public: DataSource(void); void DSInitilize(void); char* getNextElement(void); System::Void setNextElement(char* value); private: queue<char> MessageQueue; };[/CODE] It is not finding … | |
I am trying to put the contents of a char buffer[512] into a word* (type def as data type short). How do I do this? I have tried memcpy but am either getting an exception or it will run but the word* is undefined value after the copy. Any advice … | |
Has anyone ever seen a function call just get skipped? I am running in debug mode and it wont let me set a break point on the call and when i step to it it goes right over to the next line, no exceptions, no errors. Has anyone EVER seen … | |
I have a vs2005 forms app, I have added a header file with a bunch of functions, but now i get a bunch of LNK2005 errors, one for every function. How do I resolve this? Do I need to put them in a class? Thanks. | |
I am using the winsock component in vs2005. I have tried sending and recieving strings. The event of data arriving triggers and runs the following code... [CODE]private: System::Void WinSockControl_DataArrival(System::Object^ sender, AxMSWinsockLib::DMSWinsockControlEvents_DataArrivalEvent^ e) { System::String^ messageBuf = ""; this->WinSockControl->GetData(messageBuf); int i = this->WinSockControl->BytesReceived; }[/CODE] This gets run so the data is … | |
In vs2005 there is a winsock component, how do you receive data using the component? I found a ->SendData(blah), but cant find a receive. Does anyone know how to receive with this component? Thanks. | |
I am trying to open 2 forms when I start my vs2005 project. The main form, and a second form whose class is created, and then ->show. It shows both forms, but you can control either one. What I want is the main form to be "locked" until the "OK" … | |
I have a program with a bunch of threads running. I kill them all at the end of the program. I have stepped through and seen them all abort. Is there a way to see (since I cant when stepping through) which thread it is? I can see the process … | |
I want to read each line of text file and store each line into a giant buffer so I can look at all the contents. How would I do this? [CODE]int _tmain(int argc, _TCHAR* argv[]) { ifstream indata; // indata is like cin indata.open("example.txt"); // opens the file if(!indata) { … | |
I have a server running using winsock2.h TCP/IP. I open two ports on my pc, and then in a different application connect and send and receive to and from the server respectivly. In my client application receiving port, everything is working perfectly. In my server that is receiving though, it … | |
[CODE] private: delegate System::Void delegate_function(void); if(this->InvokeRequired) { AsyncCallback ^ac = gcnew AsyncCallback(&WCS::MainForm::delegate_function_callback); delegate_function ^df = gcnew delegate_function(this, &WCS::MainForm::function_to_invoke); System::IAsyncResult ^asyncresult; //Begin invoke command here. try { asyncresult = df->BeginInvoke(ac, df); //asyncresult = this->statusLight->BeginInvoke(ac, df); //this->commsStatusLight->EndInvoke(asyncresult); //df->Invoke(); df->EndInvoke(asyncresult); //df->DynamicInvoke(ac, df); } catch (...) { std::cerr << "caught"; } } public: System::Void … | |
I am using the begininvoke and endinvoke methods in visual studio 2005. [CODE] private: System::Void button_run_Click(System::Object^ sender, System::EventArgs^ e) { AsyncCallback ^ac = gcnew AsyncCallback(&InvokeTest::Form1::delegate_function_callback); delegate_function ^df = gcnew delegate_function(this, &InvokeTest::Form1::function_to_invoke); df->BeginInvoke(ac, df); } private: delegate int delegate_function(void); public: int function_to_invoke(void) { label_status->Text = "Running"; //label_status->Text = "Stopped"; } private: … | |
[CODE]String^ comPort = "COM" + this->RS232CommPortNum->Value; int baudRate = Convert::ToInt32(this->cbBaudRate->Value); com = gcnew SerialPort(comPort, baudRate); try { com->Open(); } catch (...) { ::MessageBox::Show("Invalid Port"); }[/CODE] How do I handle this excepion thrown when the com number is not valid? When I run the release version it has an error when … | |
All my communication using this delegate and function are great between forms, but this thread for receiving compiles and all, but then throws this error. I have posted the important sections of my code. If you think I need more, let me know. Thanks. I am getting a Cross thread … | |
Is there a way to make a visual studio 2005 form repaint itself every 'x' number of milliseconds? Thanks. | |
I am doing a windows forms application in Visual Studio 2005. I have all the forms, as well as some additional classes in source files for data storage. I was wondering how to update data in one class based on another class. Does this need to be done through a … | |
Re: #pragma once is the better way of doing it. ifdef, endif are outdated. | |
I am having an issue with the following code: [CODE]SerialPort^ com = gcnew SerialPort("COM1", 9600); array<unsigned char>^ messageBuf = gcnew array<unsigned char>(512); com->Open(); com->Read(messageBuf, 0, 512); com->Close(); [/CODE] messageBuf is not being filled with anything. I know the port is open cause writing works fine. Any ideas why this is? | |
I am trying to read from a serial port using System::IO:: Ports in visual studio 2005. I can write fine, but reading isnt reading in anything to the buffer. I am using the following code, similar to the way i was writing to the port. [CODE]array<unsigned char>^ messageBuf = gcnew … | |
I have a visual studio 2005 forms application that is giving me fits. I want to open a serial port in 1 form, set it to a com port in a class, then use it from that class. The problem is it gives my a null reference exception. [CODE]String^ comPort … | |
I have a visual studio 2005 form application. I also have created a header and source file with gets and sets and private variables for some of the data. How do I pass this data between forms? Ive looked at delegates but am having trouble understanding, is there another way, … | |
Does anyone know how to convert a "String^" data type in a visual studio 2005 forms app to an "int"? Ive tried atoi and casting to no success. Any ideas? Thanks. | |
Re: Q1: [CODE]#include<iostream> using namespace std; int main(){ int value,check=1; cout<<"Enter a number: "; cin>>value; while(value>=0) { int newvalue; cout<<"Enter another value: "; cin>>newvalue; if(value>newvalue) { cout<<" ....Not sequence"; value=-1; } else { value=nwvalue; if(check==1) cout<<"....is increasing"; } } return 0; }[/CODE] you need to make sure your brackets are being … | |
Re: copy your packet struct into a char buffer on the send side then send the buffer: char buffer[512]; Packet packet; //populate packet struct memcpy(&buffer, (char*)&packet, sizeof(packet)); //send buffer Then just do the reverse on the receive side. Packet packet; //receive buffer memcpy(&packet, buffer, sizeof(buffer)); Is this what you were asking? | |
I am receiving over ethernet into a 'char messageBuffer[512]' and then passing it on by a function call to 'process((char*) messageBuffer)' then in process: [CODE] void process(char* theMessage) { myStruct messageBuffer; memcpy(&myStruct, &theMessage, sizeof(theMessage)); //this line is wrong } [/CODE] Im not sure how to properly put it back into … | |
Does anyone know if rs-232 c++ code written with the windows.h library is easily changed to support rs-485 and rs-422 or if its not similar at all? Thanks. | |
Does anyone know how to get winsock2.h functions to work in a thread created by CreateThread(....)? All my code works outside a thread, but when I put it in the thread, it cannot bind the socket and read from etc. Thanks. | |
I am trying to create an ethernet socket inside a thread. The code works outside of the thread, but fails inside of it. Does anyone know what the problem is? Do I need to set up the socket outside of the thread? It compiles and runs, just fails to connect … | |
Does anybody know where I can get some basic source code on the creation and use of threads (I know about threads, just never coded them, and reading up on them, some of the inputs into CreateThread are confusing)? | |
Re: I wrote a similiar program in college about baseball players and their stats. You are looking to broadly at the assignment and getting frustrated. Focus on just 1 function. All the functions are very similiar and once you get one, the others will fall into place. I know you want … | |
Is there a way to cast a the contents of a char* buffer into an int? |
The End.