I am very new to development and have been sinking my teeth into C#. I have an application that was written in C++ which is out of my depth, and I was wondering if someone could explain how I would recreate this in c#. The application sends message to linux service via a socket connection. The message is in the form of a struct: [CODE] struct alert { unsigned short size; unsigned short signature; unsigned short bperiod; unsigned short bduty; unsigned short svolume; unsigned short stone; unsigned short sfrequency; unsigned short speriod; unsigned short sduty; }; [/CODE] This app was …

Member Avatar
Member Avatar
+0 forum 2

I can't seem to pass a struct address to a function. My program "stops working" when it gets to the scanf statement of the getReady function. [CODE]/**************************************************** Author: ---------------------------------------------------------------------- Purpose: This code will explore passing a data structure address to a function. ****************************************************/ #include <stdio> #include <stdlib> //prototypes: struct things{ char knife; char pen; char wallet; char keys; }; int getReady(struct things *t,char x); void main() { char ready; char r; struct things *t; ready =getReady(t,r); if (ready == 'y') printf("\nLet's go!!!"); } int getReady(struct things *t,char x) { printf("\nHave you got your wallet? y/n: "); scanf("%c",t->wallet); printf("\nHave you got …

Member Avatar
Member Avatar
+0 forum 3

Hello everyone, I find C not very flexible this time because I know there is an easy way to assign field values to a struct like this : [CODE]Struct mine = { field1, field2, ... };[/CODE] but in my case "mine" is contained in a bigger struct. So I have to assign let's say a field named data but it seems I cannot do : [CODE]parent->data = { field1, field2, ... };[/CODE] Moreover data in my case is an array to full with these Struct. I wish I could simply do : [CODE]unsigned int i = 0; parent->data[i++] = { …

Member Avatar
Member Avatar
+0 forum 3

Hello, I defined a list in a class and want to do a class containing get/set functions. How can I set or get a data struct (list element) that has variables of different type and each variable is taken separably as an input from the user (I do the input part in the main function, right?) Thanks

Member Avatar
Member Avatar
+0 forum 2

I have a problem where I need to be able to create an array using the data from the text file. The first line of the file is the array size and the following values need to be put into structs. There may be more than one array per txt file. The data file looks like this: 3 3 90 35d43m9s45d45m19s8 36d46m19s51d25m18s45 36d46m19s11d25m39s 7 35 23 9 25 43 9 25 25 43 9 35 33 39 30 32 33 9 17 33 22 6 15 43 19 25 43 29 108 39 33 40 25 23 29 565 25 …

Member Avatar
Member Avatar
+0 forum 14

I was wondering how one would go about creating a structure that cannot be used by itself, i.e. only through a wrapper class. My question is what would be the syntax for this construct? I'm currently on a personal project to make simple tests from old tests, all the questions will be written into a binary repository and seekable through this application. If anyone's interested it's for the Irish Leaving Certificate. The way I've done it so far is as follows: From classes.hpp [code=c++] class Student { public: static int numberofstudents = 0; Student(string name); ~Student(); private: struct address; //Forward …

Member Avatar
Member Avatar
+0 forum 2

Hi all, I have recently decided to implement struct framework with my current project. All are good except there a number of pages that uses , the particular page forwarding statement stopped working. The pages that used are all part of the "body" of the tiles. Say I have a Register.jsp page that uses signup.jsp as its body thru tiles. The sign up logic heavily relies on the to the visitors. Now the redirectives either does nothing or it breaks the page upon redirection. It makes that it will break, but i can't find a work around. I have tried …

Member Avatar
+0 forum 0

So this is my problem: as the title suggests, I have a Labyrinth class that contains two binary trees made of two different kinds of structs that represent different kinds of rooms. The names are in spanish, so Arbol means tree, Laberinto is the labyrinth class and Sala1 and Sala2 are the room structs (and Llave, in case you wonder, means key, but that's not relevant to my question). [code=c]struct Sala1 { int id; Llave cr_i; Llave cr_d; int fno_fix_i; int fno_fix_d; int fno_i; int fno_d; }; struct Sala2 { int id; Llave cr; }; class Laberinto { private: Arbol<Sala1> …

Member Avatar
Member Avatar
+0 forum 2

Hello, there. I'm trying to write a program which reads student information from keyboard and does some calculations. I've just started it and I dont know much about this "Struct" topic. As far as I know, I've tried to do something and here is the result. [CODE]#include <stdio.h> #define N 2 #define ISIMUZUN 15 struct student{ char name[ISIMUZUN]; char surname[ISIMUZUN]; char number[10]; int final; int midterm; int hw1; int hw2; }; int main(int argc, char *argv[]) { struct student i; for(i=0; i<N; i++) { printf("Please enter student number %d information with blanks between them\n", i+1); scanf( "%s %s %s %d …

Member Avatar
Member Avatar
+0 forum 15

Hi I am making an mp3 database at the moment and i have run into some difficulty when passing down the array to a function. I can do it when i create the array globally as obviously this means i dont have to pass it down, but i want to learn how to do it properly - have only been learning for a few months so i am still getting used to it all. here is my code [code=c] #include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> #define MAXLENGTH 50 #define MAXGENRE 15 #define MAXMP3FILES 100 #define MAXFILEPATH 400 #define …

Member Avatar
Member Avatar
+0 forum 3

Hey guys, Im trying to make a program that guesses the name of an animal in the users head by asking him or her a bunch of questions. The questions, answers, and line number for yes/no are inlcuded in the file animals.txt as follows: Q Does it have feathers? 2 7 Q Is it a mammal? 3 4 A lizard Q Does it have stripes? 5 6 Q Does it hop? 10 11 A tiger Q Is it tasty to eat? 8 9 A owl A chicken A elephant A kangaroo Im using a struct to organize this information: struct …

Member Avatar
Member Avatar
+0 forum 3

Hello everyone I have been trying to learn the greater mysteries of linked lists and have come across an error that is inexplicable to me at my current level of understanding. I have written a program that attempts to form a linked list to store student information in the form of a struct. This code is a modified version of an earlier program that I wrote that implemented the same functionality using arrays. The program reads the data from a file StudentRecords.txt, then allows the user to search it, display all the data, or add or delete a student record, …

Member Avatar
Member Avatar
+0 forum 7

Gentlefolk, Using C# in VS 2005. I have a struct (some components deleted for simplicity) : [code] public struct CoOrdData { public int[] coOrdMaxArray; // = new int[3]; // XYZ co-ord maximum .. .. } [/code] This is used in the following objects: [code] public CoOrdData GraphData = new CoOrdData(); public CoOrdData trackGraph = new CoOrdData(); [/code] In the constructor for the surrounding class I have: [code] // Graph parameters,set the size (3) of the array GraphData.coOrdMaxArray = new int[3]; trackGraph.coOrdMaxArray = new int[3]; [/code] This is done to establish the size of the array as you cant set the …

Member Avatar
Member Avatar
+1 forum 3

Hallo, I must develop a Client application using (Qt) C++. The server application was developed by somebody. I need to register with the Server application to get data from it. I have problems here. Can anybody please let me know how to proceed. In order to register with the server, the client must first send a Hello instruction to it. And the format for Hello is as follows: Length Contents Term Description 4 byte xx xx xx xx PACKET_LENGTH Length of the packet in byte 2 byte 00 01 HELLO Command Hello 1 byte 02 VERSION Version of protocol 1 …

Member Avatar
Member Avatar
+0 forum 1

Hi, I have a C++ dll with a header having the following struct: [CODE] struct TData { DWORD m_Command; BYTE m_Option; char m_Message[300]; }; [/CODE] The dll also has a callback function MessageReceived that takes TData as a parameter. The function fills in the m_Message with some data and returns. in VB6, I have a similar type: [CODE] Public Type TData m_Command As Long m_Option As Byte m_Message As String End Type [/CODE] when the MessageReceived is called, I have an error: The instruction at ........ referenced memory at ........ The memory could not be "written" I'm assuming that this …

Member Avatar
Member Avatar
+0 forum 1

:) Hello experts, Im taking a C++ class and i was asked to Write a program that uses a structure named MovieData to store the following information about a movie: Title Director Year Released Running Time (in minutes) I've come down to making it compile, but, when it couts the output, the line for "year released" and for "run time" is i think, the reference for those cells. I tried to dereference using the & (i.e &p.year... &p.time) operator and no luck, it gives me a runtime error, any suggestions? here is my code: [code=c++]#include <iostream> #include <iomanip> using namespace …

Member Avatar
Member Avatar
+0 forum 3

#ifndef _READFILE_H_ #define _READFILE_H_ #include<string> #include<vector> #include<map> using namespace std; class Readfile{ private: string str; vector <string> goArray; vector <string> strArray; vector <string> phyIntArray; vector <string> subArray; vector <string> proArray; /* member function */ void processString(string str); void processGoId(string); void processPhysicalInt(string); // void processMetabolicInt(string); public: typedef struct Info{ string uniprotID; vector <string> goId; vector <string> phyInt; }; map <int,struct Info> proteinData; map <int,struct Info>::iterator it; Readfile(string file);//constructor }; #endif

Member Avatar
Member Avatar
+1 forum 3

Hey guys need some help with this. I m kinda new to c++. I m trying to insert a structure into a set. and when i compile this i m a gettin an error. i guess i need to add a comparator function please let me how do i do that. Thanks. [CODE] #include <iostream> #include <set> #include <algorithm> typedef struct _CONFIG_ { char app[10]; char key[10]; }config_line; /*struct classcomp { bool operator() (const char *lhs, const char *rhs) const { int rc = strcmp(lhs,rhs); if(rc>0) return FALSE; else if(rc<0) return TRUE; else return FALSE; };*/ int main() { config_line …

Member Avatar
Member Avatar
+0 forum 1

The End.