|
Hi friends,
I have some code in C which I need to convert in C#. The very first line of C code is an Include file. So how can I convert this line in C# code or what is the equivalent of this in C#? I have already tried system.math class but I want to convert this particular in C#.
#include <math.h>
max dev
|
|
|
|
|
u can't use .h file
i think u have to convert it into class library then u can use it
|
|
|
|
|
Thanks so much for your reply. Can you tell me how can I convert it in system library ? or can you suggest any source or converter where I can convert my C Code into C# ?
max dev
|
|
|
|
|
You'll have to use the corresponding methods of System.Math and do some manual labor to adapt your C code.
|
|
|
|
|
hi all,
following is a structure that i hv define
[StructLayout(LayoutKind.Sequential, Size = 16)]
public struct MESSAGE_INFO
{
public UInt16 _MessageCode;
public UInt16 _ChannelNo;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=6)]
public UInt16[] _Parameter;
}
Now when i declare pointer to this structure, It throws the error "Cannot take the address or size of a variable of a managed type"
MESSAGE_INFO* ptrMsgInfo
But if i declare "public UInt16[] _Parameter" as only "public UInt16 _Parameter" then it compiles perfectly.
Any light on this would be highly appreciated...
Thanx in advance
Vikas Salvi
Programmer Analyst
|
|
|
|
|
Hello Vikas,
MSDN[^] says (at the top of the page) that the pointer can point to "Any user-defined struct type that contains fields of unmanaged types only". When you define the field as an array, then it's considered a managed type. When you define it as just a UInt16, then it's considered an unmanaged type (sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal, or bool).
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
How can we create a new file in a selected folder.
also is there any kind of limitation on file type( file format) which we can create.
I want to create a new file in whichever folder a user chooses?
|
|
|
|
|
|
Sometimes its not what you search, for but how. Not knowing how to word a proper search is pretty common, even among professionals.
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
WHich is worrying ... they should atleast be able to do "c# a few keywords" X(
|
|
|
|
|
Welcome to the Human Race
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
but how do you send two arguments to be put in one string array when the called function has one string array defined in its header..
private void SayHi(string[] str_In)
{
MessageBox.Show(<blink>str_In[0]</blink>+" "+<blink>str_In[1]</blink>);
}
...
SayHi(<blink>"Hi"</blink>,<blink>"Cpian!"</blink>);
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
private void SayHi(params string[] s)
{
// ...
}
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
If you want to send an array, you have to create an array:
SayHi(new string[] { "Hi","Cpian!" } );
If you use the params keyword, the parameters sent to the method will become an array:
private void SayHi(params string[] str_In)<br />
<br />
SayHi("Hi","Cpian!");<br />
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi,
I'm new to C# and the whole server/client thing, as an exercise I've made a simple board game for two players, now I'd like to make it playable on the net which is obviously not a trivial task (for me anywayz). I was looking for SIMPLE tutorials or articles about creating a web servers and clients, but havnt found anything basic enough - I need an example of client and server passing very basic pieces of data (strings?) on simple events between them, but the articles I've seen deal with more complex project. A point in the right directon would be very appreciated, thanx.
|
|
|
|
|
Remoting is an easy way of getting data flowing between the server and the clients.
Take a look at MSDN http://msdn2.microsoft.com/en-us/library/ms973857.aspx[^] or CodeProject http://www.codeproject.com/csharp/dotnetremotingbasictutor.asp[^]
Try creating two custom objects that you use as communication channels.
Let the server expose it's serverchannel object through remoting, and when client contacts the server through the channel, it can register the client and set up a remoting connection back to the clientchannel object, which the client exposes through remoting aswell.
You can put appropriate communication and game methods in these channels aswell as events which you can monitor.
-Larantz-
-- Modified --
If you choose to go for a remoting solution where both sides expose a marshalled (remoting) object, remember to have each side set up their own remoting servers before they try and contact the other side. Otherwise the attemt at setting up local remoting server will fail as the remoting proxy from the otherside blocks the local server from being set up correctly.
|
|
|
|
|
Thanx will try that tomorrow when I can have both my eyes looking in one direction btw, gotta love your signature
|
|
|
|
|
sqlite[^] is very good it's 1 dll (well in its pure native form) and then 1 db file per user if thats the way you want it
not sure how it'd handle that much data but it's worth a look.
You still use ado.net to "connect" to it but it local and file based rather than network based.
|
|
|
|
|
Thank you )
Looking in to it now! *Does a dance*.
jeremy
|
|
|
|
|
without importing from win32 dll-s
or how do I communicate with a device with C# build in classes.
Does C# has something like this ? classes for registering/unregistering a service, and communicating via IOCTL's
thank you
B.Gabriel
|
|
|
|
|
euacela wrote: without importing from win32 dll-s
Use DeviceIoControl without using Win32?? Impossible. You have no choice but to import the function calls.
euacela wrote: how do I communicate with a device with C# build in classes.
That depends entirely on the device in question, but if it's not connected to a Serial Port, you don't. There are no classes native to the .NET Framework that deal with device communication, like USB, PCI, low level disk/volume work, ...
euacela wrote: classes for registering/unregistering a service
Yes, this is built into the .NET BCL. I believe it's the ServiceInstaller[^] class in the System.ServiceProcess namespace.
euacela wrote: communicating via IOCTL's
No, this is NOT in the .NET BCL.
|
|
|
|
|
Hi
In my program a have a series of images that i would like to save as an animated gif. Is this possible in c#, im using visual c# express ed. If not how easy/hard is it to save images into a windows movie file if at all possible.
Many thanks.
|
|
|
|
|
This will help you: http://www.codeproject.com/dotnet/NGif.asp
As for movie, you will need DirectX as I guess but I'm not sure as I'm not experienced in that field
|
|
|
|
|
Hi,
I want to check that any of the property on from related to controls is changed or not.
How can i do it in C#.
Plz mail as soon as possible.
Amit Verma
73amit@gmail.com
|
|
|
|
|
Hello,
i have a problem with retrieving a jagged array from my webservice the array looks like this:
Array ( [0] => Array ( [0] => id [1] => int(11) [2] => YES [3] => [4] => ) [1] => Array ( [0] => name [1] => varchar(255) [2] => YES [3] => [4] => ) )
SyncITSoap SyncITSoap = new SyncITSoap();
object columns = SyncITSoap.getColumns("", "", "syncit","test");
error message when the methode is called getColumns = {"The specified type was not recognized: name='Columns', namespace='http://server.e-ss.nl:8100/service', at <columns xmlns=''>."}
can somebody help me out? thx in advance
wdsl is this:
WDSL Jagged array problem
<?xml version="1.0" encoding="utf-8"?>
<definitions
name="SyncIT"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
targetNamespace="http://server.e-ss.nl:8100/service"
xmlns:tns="http://server.e-ss.nl:8100/service"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema targetNamespace="http://server.e-ss.nl:8100/service" xmlns:impl="http://server.e-ss.nl:8100/service" xmlns="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="Database">
<xsd:all>
<xsd:element name="name" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="DatabaseArray">
<xsd:complexContent mixed="false">
<xsd:restriction base="soapenc:Array">
<xsd:attribute foobar:arrayType="tns:Database[]" ref="soapenc:arrayType" xmlns:foobar="http://schemas.xmlsoap.org/wsdl/"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="Table">
<xsd:all>
<xsd:element name="name" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="TableArray">
<xsd:complexContent mixed="false">
<xsd:restriction base="soapenc:Array">
<xsd:attribute foobar:arrayType="tns:Table[]" ref="soapenc:arrayType" xmlns:foobar="http://schemas.xmlsoap.org/wsdl/"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="Columns">
<xsd:complexContent mixed="false">
<xsd:restriction base="soapenc:Array">
<xsd:attribute foobar:arrayType="xsd:string[]" ref="soapenc:arrayType" xmlns:foobar="http://schemas.xmlsoap.org/wsdl/"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="ColumnArray">
<xsd:complexContent mixed="false">
<xsd:restriction base="soapenc:Array">
<xsd:attribute foobar:arrayType="tns:Columns[]" ref="soapenc:arrayType" xmlns:foobar="http://schemas.xmlsoap.org/wsdl/"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
</types>
<message name="getDatabasesRequest">
<part name="login" type="xsd:string"/>
<part name="password" type="xsd:string"/>
</message>
<message name="getDatabasesResponse">
<part name="databases" type="tns:DatabaseArray"/>
</message>
<message name="getTablesRequest">
<part name="login" type="xsd:string"/>
<part name="password" type="xsd:string"/>
<part name="db" type="xsd:string"/>
</message>
<message name="getTablesResponse">
<part name="tables" type="tns:TableArray"/>
</message>
<message name="getColumnsRequest">
<part name="login" type="xsd:string"/>
<part name="password" type="xsd:string"/>
<part name="db" type="xsd:string"/>
<part name="table" type="xsd:string"/>
</message>
<message name="getColumnsResponse">
<part name="columns" type="tns:ColumnArray"/>
</message>
<portType name="SyncITPort">
<operation name="getDatabases">
<input message="tns:getDatabasesRequest"/>
<output message="tns:getDatabasesResponse"/>
</operation>
<operation name="getTables">
<input message="tns:getTablesRequest"/>
<output message="tns:getTablesResponse"/>
</operation>
<operation name="getColumns">
<input message="tns:getColumnsRequest"/>
<output message="tns:getColumnsResponse"/>
</operation>
</portType>
<binding name="SOAP" type="tns:SyncITPort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="getDatabases">
<soap:operation soapAction="urn:syncitsoap#getDatabases"/>
<input>
<soap:body use="encoded" namespace="urn:syncitsoap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:syncitsoap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="getTables">
<soap:operation soapAction="urn:syncitsoap#getTables"/>
<input>
<soap:body use="encoded" namespace="urn:syncitsoap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:syncitsoap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="getColumns">
<soap:operation soapAction="urn:syncitsoap#getColumns"/>
<input>
<soap:body use="encoded" namespace="urn:syncitsoap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:syncitsoap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="SyncITSoap">
<port name="SyncITPort" binding="tns:SOAP">
<soap:address location="http://server.e-ss.nl:8100/service/service.php"/>
</port>
</service>
</definitions>
|
|
|
|