|
I may be missing something, but...
run it under the debugger using either the mixed mode or managed debugger.
|
|
|
|
|
Hello friends,
I have a file containing:
1499,0508,00747522,13:56:22.289248,13:56:23.232780,50182289248,50183232780,-943532
600 lines like this
I declared a structure like this
struct data{
int c1;
int c2;
long int c3;
char c4[15];
char c5[15];
long double c6;
long double c7;
int c8;};
and in the main program
FILE *fp=NULL;
int i=0,j=0,k=0;
char c=NULL,cc=NULL;
fp = fopen("res.txt","r");
for(i=0;i<601;i++)
fscanf(fp,"%d, %d, %ld,",&c1,&c2,&c3);
for(j=0;j<15;j++){
fscanf(fp,"%c,",&c);
c4[j]=c;}
for(k=0;k<15;k++){
fscanf(fp,"%c,",&cc);
c5[k]=cc;}
fscanf(fp,"%E,",&c6);
fscanf(fp,"%E,",&c7);
fscanf(fp,"%d\n",&c8);
and when i tried to print cdata[i].c4,c5,c6,c7,c8 etc for some i value...Im getting garbage value...
Can anyone of you help me?
how to tackle that c4 and c5?
is it right to take long double for c6,c7?
thanx in advance...
Regards
|
|
|
|
|
I need to send data with using serial port. and i found AxMSComm can u explain what is AxMSComm and how we use it.
-------------------------------------------------------
haven`t sign yet
|
|
|
|
|
|
Thanks for the link. actually VS .Net 2003 beta doesn`t find
#using <axmscommlib.dll>
#using <mscommlib.dll>
using namespace AxMSCommLib;
using namespace MSCommLib;
unless i drag the AxMSComm from "Microsoft Communications Control" from toolbox menu
when i drag it
this->axMSComm1->Handshaking = HandshakingConstants::NoHandshaking; // no handshake is used
It doesnt find NoHandshaking function
what is the reason that VS 2003 .Net compiler doesn`t find that functions.
thanks!!
|
|
|
|
|
Hi there,
I have a strange thing happening with calloc/malloc. Here is my code:
...
double *a = (double*)malloc(Na*sizeof(double));
double *b = (double*)malloc(Nb*sizeof(double));
double *c = (double*)malloc(Nc*sizeof(double));
...
The problem is that the two pointers b and c point toward the same address. Anyone aware of this problem and how to fix it?? (I'm working under .NET2003)
Thanks a lot.
|
|
|
|
|
|
Yes, sorry for disturbance. Would that be in the Visual C++/MFC forum?
|
|
|
|
|
|
Hello...
I have a function called:
MyFunction(LPCVOID lpBuffer)
{
}
But my parameter is a String*, for example:
String* s = "Hello World";
Are there any possibilities to cast String* to LPCVOID ?
|
|
|
|
|
|
See System::Runtime::InteropServices::Marshal class.
|
|
|
|
|
You can't do a plain cast from a managed pointer to an unmanged one, you need to pin the managed pointer so the underlying object doesn't move during GCs.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Hi, I would like to know how to search through a file for specific words or phrases using VisualC++ 2003
-- modified at 7:38 Thursday 20th July, 2006
|
|
|
|
|
Load the file into memory and search then. It's easier and faster.
|
|
|
|
|
I currently have a COM component (and source) that talks to a printer and also a hardware port through a Vendor supplied DLL that makes fairly low level calls, and was wondering if there is a reference for displaying how to create a Managed Assembly in C++ that can performed the unmanaged calls, but present a nice .Net interface for the other developers. It does lots of GetProcAddress and
I would prefer not to interop to my existing COM Component, because I am trying to get a clean project.
I could possibly do it in C#, but wondering if it would be better in managed C++?
<br />
PORTOUT PortOut;<br />
PORTWORDOUT PortWordOut;<br />
PORTDWORDOUT PortDWordOut;<br />
PORTIN PortIn;<br />
PORTWORDIN PortWordIn;<br />
PORTDWORDIN PortDWordIn;<br />
SETPORTBIT SetPortBit;<br />
CLRPORTBIT ClrPortBit;<br />
NOTPORTBIT NotPortBit;<br />
GETPORTBIT GetPortBit;<br />
RIGHTPORTSHIFT RightPortShift;<br />
LEFTPORTSHIFT LeftPortShift;<br />
ISDRIVERINSTALLED IsDriverInstalled;<br />
...<br />
and then makes calls like this<br />
...<br />
<br />
LoadIODLL();<br />
PortOut(0x2E,(unsigned char) 0x87);<br />
PortOut(0x2E,(unsigned char) 0x87);<br />
PortOut(0x2E,(unsigned char) 0x07);<br />
PortOut(0x2F,(unsigned char) 0x07);<br />
PortOut(0x2E,(unsigned char) 0xf1);<br />
<br />
...<br />
<br />
hio = LoadLibrary("cashdrawerio.dll");<br />
if (hio == NULL)<br />
{<br />
return;<br />
}<br />
else<br />
{<br />
<br />
PortOut = (PORTOUT)GetProcAddress(hio, "PortOut");<br />
PortWordOut = (PORTWORDOUT)GetProcAddress(hio, "PortWordOut");<br />
PortDWordOut = (PORTDWORDOUT)GetProcAddress(hio, "PortDWordOut");<br />
PortIn = (PORTIN)GetProcAddress(hio, "PortIn");<br />
PortWordIn = (PORTWORDIN)GetProcAddress(hio, "PortWordIn");<br />
PortDWordIn = (PORTDWORDIN)GetProcAddress(hio, "PortDWordIn");<br />
SetPortBit = (SETPORTBIT)GetProcAddress(hio, "SetPortBit");<br />
ClrPortBit = (CLRPORTBIT)GetProcAddress(hio, "ClrPortBit");<br />
NotPortBit = (NOTPORTBIT)GetProcAddress(hio, "NotPortBit");<br />
GetPortBit = (GETPORTBIT)GetProcAddress(hio, "GetPortBit");<br />
RightPortShift = (RIGHTPORTSHIFT)GetProcAddress(hio, "RightPortShift");<br />
LeftPortShift = (LEFTPORTSHIFT)GetProcAddress(hio, "LeftPortShift");<br />
IsDriverInstalled = (ISDRIVERINSTALLED)GetProcAddress(hio, "IsDriverInstalled");<br />
<br />
}<br />
|
|
|
|
|
Hi there..
I'm currently writing a managed c++ application which adds user entered data (textbox) into a access database.
I have some problems with formatting the sql string in the right format.. this is the sql string:
String *sqlstr = S"INSERT INTO klanten (Naam, Adres) VALUES", textBox1->Text->ToString(), textBox2->Text->ToString();
When running the program I get the following error:
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
I don't know how to correct the sql string
|
|
|
|
|
vincent7_6 wrote: I don't know how to correct the sql string
Debug the application and get the sql string value. Then find out why it is not valid SQL. If you don't know SQL well enough to determine the problem, CodeProject has a SQL forum you get help from.
Also using SQL in this fashion makes the application vulnerable to "SQL Injection Attack".
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
SQL Syntax is:
INSERT INTO klanten (Naam, Adres) VALUES ('Whatever','Whatever')
But like led mike said, you should guard against:SQL Injection Attacks[^]
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Using the designer to create the main form for an application generated the following code in the .cpp file:
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
System::Threading::Thread::CurrentThread->ApartmentState = System::Threading::ApartmentState::STA;
Application::Run(new DataForm(lpCmdLine));
return 0;
}
The DataForm class has a button which generates a new form:
linkedForm = new LinkedForm() ;
The LinkedForm class exists in the same namespace as the DataForm class.
What needs to be done to allow this child form to see public methods in it's parent, since a DataForm ptr cannot be declared globally? Are there any examples of parent/child form communications of this nature?
Thanks,
MrHonus
|
|
|
|
|
See the MVC (Model-View-Controller) design pattern. It is on Wikipedia. Forms are Views and should not be coupled. Views (Forms) should access a "Controller" to initiate action based on UI (User) events. Views subscribe to events exposed from the "Model" to be notified of data and/or "state" changes. Views then obtain the latest data to display from the "Model".
|
|
|
|
|
Well, since I used the .net designer to create all of the views, it doesn't seem to lend itself to mvc. Are there any examples of how to use mvc with studio/net generated forms?
Thanks for the reply
|
|
|
|
|
mrhonus wrote: it doesn't seem to lend itself to mvc.
That makes no sense.
mrhonus wrote: Are there any examples of how to use mvc with studio/net generated forms?
Sure the Microsoft UI Composit Application Block[^]
|
|
|
|
|
I agree, it makes no sense.
Well, I am looking for C++ examples.
Thanks
|
|
|
|
|
mrhonus wrote: Well, I am looking for C++ examples.
You are using .NET WinForms
mrhonus wrote: Application::Run(new DataForm(lpCmdLine));
The application block is .NET library so you can use it. If you can't translate C# samples into Managed C++ why are you doing Managed Development in C++?
|
|
|
|