|
The key point in the code was not focused on switch but polymorphism. You should have a look at the downcasts, upcasts, and the usage about dynamic_cast<> in your textbooks.
If you insist to replace the switch in the code, try if - else.
Maxwell Chen
|
|
|
|
|
When I am writing a little endian 4 byte int for the integer value 10 it writes out 5 bytes: '0D 0A 00 00', which is an extra byte in the first position.
10 should be '0A 00 00' but no matter how I try to write it out it ends up with 0D (which is the value signed byte 13).
The program creating the file is a C program using the fwrite function:
int Total_Points_Qt;
fwrite(&Total_Points_Qt, 4, 1, File);
The value is in an integer. I have tried unsigned int as well and it does not make a difference.
The extra byte problem does not occur at the values 1-9 and goes away at 11 and does not reoccur again at any other integer value except 10.
Does anyone know why this happens?
Thanks,
Steven
|
|
|
|
|
How to get HDD fabric number in NET?
were rgrtgrtvrtrt rtrtb brt tyuhjghj hbhbnh hnjm 1234567?
|
|
|
|
|
Sub : How to use Amazon Web Services..
Hi all...
Please let me know How to start with amazon web services..
I'm not finding any XML or REST Query format to send request to amazon..
I've purchased Seller account but How to use that to upload Items..I don't know...
Please help me getting start..
I hope some one definatly know about this
e-mail if attachment at sumit_kapoor1980@hotmail.com
Thanks...
--Sumit Kapoor---
|
|
|
|
|
1) Wath is the corret way to use "put_Picture" for an Image control if I have the Path of the Picture to load (C++ MFC)?
2)How can I find the Ptah of the application that is running?
Thank's for all
Sorry for my English!!
Giulia
|
|
|
|
|
Hi,
My COM Component has a get method that takes pointer to the struct as input.
but when i use interop it is converted to the value not as pointer.
What happens to the pointer parameters during interop.
Blue Pill or Red Pill........??
|
|
|
|
|
Hi,
My COM (unmanaged) COmponent has a get method that returns the pointer to
the array of structures.
When using Interop Services ( i.e convertin to managed code by add refernce)
it shows that get method in managed code is simply returning a strucutre and
not a pointer to the array of structures.
How to solve this issue ?
I need the array of structures to be passed - does it needs to do anything
with boxing and unboxing.
Pls help.
Blue Pill or Red Pill........??
|
|
|
|
|
Hi,
Everytime some exception occurs i am unable to get the hold of exception,
how to debug the COM Interop scenario when the code and symbols are loacted
in Unmanaged Code and i am only using the Physiacl COM DLL.
Pls suggest.
Also Would WinDebugger help in this.?
Blue Pill or Red Pill........??
|
|
|
|
|
Hi,
i am using a COM component in the C# code , but when i retriive the
user-defined structure thru the COM Server and assign it to some struct it
fails.
Access Violation
What is the analogue of structure in C# and Also in managed C++.
Blue Pill or Red Pill........??
|
|
|
|
|
How can I consume a managed dll such as a dll that created by C# in unmanaged code like a MFC project?
|
|
|
|
|
#using <mscorlib.dll>
#using <system.drawing.dll>
using namespace System::Drawing;
...stuff...
you can replace drawing.dll with yours...
|
|
|
|
|
What is the Managed C++ !!!?
I want to know more about it and Do I must have VC++ .Net to use it or not??
Thanks
ahmed
|
|
|
|
|
How do i create a dll [roject in c++.net using the managed classes. I can do this in the standard c++ but I dont know how to do this with the new .NET framework for c++. Any help in how to do this or simply set up the project would be great -- Thanks in advance
|
|
|
|
|
How can i clear socket's incoming buffer??
|
|
|
|
|
by reading in it ...
TOXCCT >>> GEII power
|
|
|
|
|
I keep getting these errors and I can't figure out why the errors are there.
The line that is throwing these errors is this:
String * pstrDisplay;
BankAccount *pabnkAccounts __gc[];
int pintCurAccount;
pstrDisplay<<pabnkAccounts[pintCurAccount];
I am overloading the << operator like this:
// In class definition
static String *op_LeftShift( String *&, BankAccount * );
// Implementation
static String *op_LeftShift( String *&vstrOut, BankAccount *vbnkAccount )
{
vstrOut = String::Concat("Account Number: ",
vbnkAccount->GetAccountNumber().ToString()),
"\010\013");
return vstrOut;
}
Any help would be great.
|
|
|
|
|
cdmlb wrote:
Did you put
#include "iostream"
You still need to do this even if you are using MC++
I did this and there was no difference, I got the same error.
cdmlb wrote:
why not use
cout <<pabnkaccounts[pintcuraccount]<<endl;< i="">
I would do this but the BankAccount class is a managed class and I get errors when I try to use ostream in the overload it throws an error saying I can't use unmanaged code in a managed class.
cdmlb wrote:
Console.WriteLine(pabnkAccounts[pintCurAccount].ToString());
I would do something like this, unfortunately it is for school and I have to use the overload method.
I guess that I will have to keep messing around with it. I hope that I won’t have to rewrite the class as unmanaged, but I have to do what I have to do.
Thanks for your help anyway
|
|
|
|
|
Well it's weird I write managed and unmanaged code inline all the time. Maybe you could send the file so I can look closer at it.
Information Technologist
|
|
|
|
|
I could not figure out how to send it to you so I put it online. Here is a link to it:
http://chartermi.net/~reznod/problemcode.zip
The line that is giving me the errors is in 'Part123.cpp' in Part123(), the 3rd case of the switch statement.
I appreciate your help very much.
|
|
|
|
|
Hi! I've spent all day trying to figure out how to write a program to talk to a MySQL database. I'm new to the .NET framework, but it seems like it would be straightforward enough. I tried using MySQLDriverCS but it give me debug errors, something about not finding required files. Also, I haven't found a way to get the standard MySQL API working on .NET. So, is there a way to make MySQLDriverCS work for managed c++ or could someone tell me how to setup the MySQL API for Visual C++ .NET?
-- Steve
|
|
|
|
|
How would I change the data in a 6x5 char array in selected cells with a variable? i.e.
eeeeee
e
eee
e
eeeeee
How would I change the e's to g's and display the following?
gggggg
g
ggg
g
gggggg
|
|
|
|
|
using System;
namespace MyConsoleApplication
{
class MyClass
{
[STAThread]
static void Main(string[] args)
{
char[,] arrayName = new char[6,5]; //double subscripted array 6x5
//initialize array with e's since
//I don't feel like making a shape
//like you did with e's and spaces
for(int i=0; i < arrayName.GetLength(0); i++)
{
for(int j=0; j < arrayName.GetLength(1); j++)
{
arrayName[i,j] = 'e';
Console.WriteLine(arrayName[i,j]); //print to the screen
//to see if did what I wanted
//to test it out
}
}
for(int i=0; i < arrayName.GetLength(0); i++)
{
for(int j=0; j < arrayName.GetLength(1); j++)
{
if(arrayName[i,j].Equals('e')) //find only e's replace with g's
{
arrayName[i,j] = 'g';
Console.WriteLine(arrayName[i,j]); //print to the screen
//to see if it did replace
//replace all e's
}
}
}
Console.ReadLine(); //pause
}
}
}
It does work, this code will ingore all other char like spaces you made to create the shape and only replace the e's with g's, code works for any mc++, c# application type.
Information Technologist
|
|
|
|
|
Can someone give me the source code of a simple tetris in c++ language??
I have this assignment for my algorythm and programming lesson...sooner better...thank u very2 much!!
|
|
|
|
|
Hi!
Recently i downloaded an article from this page. This project was programmed in C++ with managed extensions and serves as a .NET Wrapper around a existing C++ implementation of random generators and distributions.
I added this project to my solution that consist of a C# windows application. Under VS.NET 2003 everything worked well and i could use the wrapped random generators and distributions.
Unfortunately, i had to move my solution back to VS.NET 2002. My C# windows application still works well, but the downloaded project doesn't get compiled. I receive the following errors, which i noted besides the lines that generate them:
<br />
template<class T><br />
struct ptr_helper<br />
{<br />
typedef T value_type;<br />
typedef T& reference_type;
typedef const T& rvalue_type;
static reference_type ref(T& r) { return r; }
static const T& ref(const T& r) { return r; }
};<br />
This struct is declared in a header-file of the existing C++ implementation that gets wrapped by the downloaded project.
Why can i compile this under VS.NET 2003 but not in VS.NET2002? What i can i do?
THX in advance
|
|
|
|
|
Hi, I have program written in C#. I want to use some functions from it. I have DLL, but not sure how I can call that functions from C++ application. If some one can help or direct me to the sample code.
Thanks
|
|
|
|