473,803 Members | 3,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

pass structure as reference

1 New Member
i have declear one structure typedef struct { char name[20]; int age;} INFO
another file and create one structure vasrable str1 in main,
I want to pass the addres for another function linke fun( &str1);
in this function i am read data from a file like

void fun ( INFO * str )
READ (HANDLE, &str,sizeof(str 1));
that is write or not ?
i wnat to print info in main
Oct 1 '07 #1
2 1611
hariharanmca
1,977 Top Contributor
i have declear one structure typedef struct { char name[20]; int age;} INFO
another file and create one structure vasrable str1 in main,
I want to pass the addres for another function linke fun( &str1);
in this function i am read data from a file like

void fun ( INFO * str )
READ (HANDLE, &str,sizeof(str 1));
that is write or not ?
i wnat to print info in main
Check where you are declaring to str1?

I think this thread will help you

Structure
Oct 1 '07 #2
Savage
1,764 Recognized Expert Top Contributor
i have declear one structure typedef struct { char name[20]; int age;} INFO
another file and create one structure vasrable str1 in main,
I want to pass the addres for another function linke fun( &str1);
in this function i am read data from a file like

void fun ( INFO * str )
READ (HANDLE, &str,sizeof(str 1));
that is write or not ?
i wnat to print info in main
void fun ( INFO * str ) this is right,but READ (HANDLE, &str,sizeof(str 1)); isn't.

You will need to read each member of the struct separately.

Savage
Oct 1 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
9503
by: Jan Pieter Kunst | last post by:
(apologies if this message is a duplicate -- my news server seems to have problems) Greetings, When using PHP 4, this: // ex. 1 class A { function A(&$obj) {
3
3647
by: Panda2 | last post by:
Say I have a structure such as: struct Barn{ char type; int number; }animal so for example we might have data like animal.type cow animal.number 10
110
9972
by: Mr A | last post by:
Hi! I've been thinking about passing parameteras using references instead of pointers in order to emphasize that the parameter must be an object. Exemple: void func(Objec& object); //object must be an object instead of
38
4637
by: Radde | last post by:
HI all, Whats the difference b/w pass by ref and pass by pointer in C++ when ur passing objects as args.. Cheers..
2
6652
by: Maloney | last post by:
I'm trying to pass a structer from C# to a C dll in .Net Compact Framework This partially works. If in the GetStatus I only set -- status->fileLength = 10; -- and not the second variable then filelength = 10 and fileposition = 0, but if i set the second one only or both of them then they are fileLength = 47244640266 and filePosition = 0; Like the memory is getting over wrote. What is the correct way of passing a structure by reference...
6
2715
by: lisp9000 | last post by:
I've read that C allows two ways to pass information between functions: o Pass by Value o Pass by Reference I was talking to some C programmers and they told me there is no such thing as pass by reference in C since you are just passing an address (or a pointer value address I guess?). So I was wondering is this correct?
3
23777
by: sisqorap | last post by:
Hi all, I have this kind of warning and would like to have it solved: Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of xml_parse_into_struct(). If you would like to enable call-time pass-by- reference, you can set allow_call_time_pass_reference to true in your INI file. in /bla.php on line 94 The code which is behind is like this:
9
5019
by: grbgooglefan | last post by:
I am trying to pass a C++ object to Python function. This Python function then calls another C++ function which then uses this C++ object to call methods of that object's class. I tried something like this, but it did not work, gave core dump. class myclass { public: myclass(){}; ~myclass(){};
12
3021
by: Bryan Parkoff | last post by:
I write my large project in C++ source code. My C++ source code contains approximate four thousand small functions. Most of them are inline. I define variables and functions in the global scope. The global variables and global functions are hidden to prevent from accessing by the programmers. All global functions share global variables. Only very few global functions are allowed to be reusability for the programmers to use. Few...
0
9703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10548
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10295
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7604
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6842
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5500
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.