|
birajendu wrote: is there any API
Yes, it's all here[^] in MSDN; something you should familiarise yourself with.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
|
hi,i am trying to use arrays to read text from a file on another location before sending it out byte by byte but i not very familiar with using arrays for my coding,so if you could do help me correct my coding.
void loop()
{
char Msg[]={"Hello"};
char *start;
int i=0;
if(!BT.createConnection("0017E5F1CD3B","02")) {
USB.println("");
USB.print("--- CONNECTION -- MTU: ");
USB.print(BT.connection_mtu[0],BYTE); USB.print(BT.connection_mtu[1],BYTE);
USB.println(BT.connection_mtu[2],BYTE);
}
else USB.println("Connection failed");
start=Msg;
if(USB.println("Data sent OK");
else USB.println("Error while sending data");
if(!BT.removeConnection()) USB.println("Connection removed");
else USB.println("Error while removing connection");
if(!BT.removeTrustedDevice("0017E5F1CD3B")) USB.println("Trusted Device removed");
else USB.println("Error while removing trusted device");
BT.OFF();
}
|
|
|
|
|
I don't see anything in the above referring to reading (or even opening) a file. You have the line start=Msg; half way down your code but you never do anything with either variable; what is their purpose?
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
thanks for the prompt reply.If i were to use array to read a file from a location and send it byte by byte,how should i do it?
|
|
|
|
|
rezen85 wrote: If i were to use array to read a file from a location and send it byte by byte,how should i do it?
Well the question almost answers itself. Firstly, you will always read into an array, unless you are reading the file byte by byte (or using some other elementary type). Secondly, once you have the data in your array it is simply a matter of iterating through it and processing each byte as required. Take a look at fstream[^], CreateFile[^] and associated functions (if Windows), or fopen[^] etc., for reading files.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
|
|
|
Application crashes at RichEditCtrl.StremOut(), It says attempt to read write protected memory. this often an indication that the other memory is corrupt.
May I know some path to find the issue and fix the issue. Any idea ?
|
|
|
|
|
Check the parameters in your code including your streamout callback routine. You could post a copy here for others to review.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Sorry here it is :
.....
if (0 != file.Open(m_str, CFile::modeCreate | CFile::modeWrite, &e))
{
EDITSTREAM es = {0};
es.pfnCallback = COleElement::CallFunction;
es.dwError = 0;
es.dwCookie = (DWORD)&file;
lRet = m_cRichEdCt.StreamOut(SF_RTF, es);
}
..........
DWORD CALLBACK CMyClass::CallFunction(DWORD dwCookie, LPBYTE lpBuf,LONG nCount, LONG* Write)
{
CFile* pFile = (CFile*)dwCookie;
if (pFile)
{
pFile->Write(lpBuf, nCount);
}
*Write = nCount;
return 0;
}
|
|
|
|
|
I can see nothing wrong with your code, in fact it is almost a copy of the sample on MSDN. My only suggestion would be to run it through the debugger and see if you can find which value is not valid when the failure occurs.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
|
Hi, Im including one thirdparty reference to my coding.But when i use it my coding it shows error.
My code: In TagInfo.h
ref class Globals
{
public:
static DUAL_INOUTLib::DualInOut^ objVM;
};
Im using it in my coding as In TagInfo.cpp
void CTagController :: ReceiveLivePoints()
{
float PV,SV,MV,P,I,D;
CString name = GetTagName();
System::String^ TgName = gcnew String( name);
double ds;
Globals::objVM = gcnew DUAL_INOUTLib::DualInOut;
Globals::objVM->Open_InOut("ShareMemory", "FRACT", p);
Globals::objVM->Get_real(p, TgName, _T("PV"), ds);
PV = float(ds);
}
But it shows error in line Globals::objVM = gcnew DUAL_INOUTLib::DualInOut as
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in FOPStation.exe Additional information: Retrieving the COM class factory for component with CLSID {52762B50-F702-11D2-9EB1-00C04F888C49} failed due to the following error: 8001010d.
TagInfo.cpp contains more class like, CTagbase,CTagController,CTagIndicator etc.,...I want to use this DualInOut in every class to get values
Anu
|
|
|
|
|
Are you sure you are adding a reference to the managed DLL? It seems to me you may be adding an RCW reference to a COM library?
|
|
|
|
|
Actaully im adding DualInOut.exe(this is wha i want to add).Im addind this to my project through
Add->Reference->Browse and choose the path of exe in programFiles.Thats it.
Then im using it in my code.
It works fine when im using it same clas..For Example,if i defined that class in mainframe.h and if im using that class in MainFrame OnCreate() then it works fine.
But when im using it in different class.Then its not coming??..
Anu
|
|
|
|
|
Is DualInOut.exe a .NET executable or is it a COM server?
|
|
|
|
|
When i see the comment of that exe,it tells that InOut Dual Interface Outprocess COM Sever
Anu
|
|
|
|
|
When i use this whole coding in Mainframe OnTimer() it works fine.
But i have to get lot of live values..So i have to put this in Thread.
So when i do that,it shows error of
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in FOPStation.exe
Additional information: Retrieving the COM class factory for component with CLSID {52762B50-F702-11D2-9EB1-00C04F888C49} failed due to the following error: 8001010d.
Anu
|
|
|
|
|
void main()
{
float a=0.7;
if(a<0.7)
printf("A");
else
printf("B");
getch();
}
If i m putting 0.7 and 0.9 in the question answer is coming "A".else for every option as 0.3,0.5,0.6,0.8 it is coming "B".Why is it so??/...I know the float and double concept...dont tell that...but why is difference in answers ..please focus on that.
|
|
|
|
|
mstanwar wrote: I know the float and double concept
do you really?
0.7 is a real number; it cannot be represented exactly as it is not equal to an integer times some power of 2.
therefore, it has an inherent inaccuracy.
furthermore, it is a double (real constants are double by default in C-like languages); assigning it to a float enlarges the inaccuracy, as there are fewer mantissa bits in a float than there are in a double.
a<0.7 is an expression that gets evaluated as doubles (see the language specification); so you are basically comparing the float representation and the double representation of the number 0.7, and those are both approximations, and unequal, and either one may be the larger one.
If you really knew about floats and doubles, you wouldn't carelessly mix them like that.
|
|
|
|
|
Hi,
I dont know whether this is the right forum to ask this question.
If any 1 can help me about telling what is the basic idea of an intellisense type listbox which doesnt loose focus when we type in the editor. I will use this listbox inside regular MS notepad. I have created hooking application which will show dialog at the caret position but the notepad is loosing focus when the list is appearing.
Thanks in advance.
Regards,
John.
|
|
|
|
|
Do you want a .NET answer? If you want an answer from a native code perspective, you may want to post this in the C++ forum (this is the C++/CLI forum).
|
|
|
|
|
Well i looked a solution to call function from a process that is complitly different from another process so i readed about Interprocess Communication. Now i have only seen some data moving data copying and some text show up tutorials but there is nothing about how to call a function from another process can anyone point me somewhere...?
|
|
|
|