Sponsored Content
Full Discussion: Deep copy of structure in C
Top Forums Programming Deep copy of structure in C Post 302906354 by breezevinay on Thursday 19th of June 2014 05:47:42 AM
Old 06-19-2014
For me whole linked list has to be copied .

Yes for third point ,
We need to allocate different chunks of memory.

Additional information :

Actually my problem is the variable iter in the code gets corrupted , Using the vaue of iter we try to connect to some host using a
fuction
mcc_ipc_connect_a(iter-ai_family,SOCK_STREAM, 0, &conn->socket,
(MCC_T_SYS_SOCKADDR*)(iter->ai_addr), iter->ai_addrlen);

Here due to whatever reasons , the connection doesnt establish and later result in retry for connection and timesout. This corrupts iter structure , which will be used iterate . As this is corrupted and is invalid structure , the application results in core dump.
so we are thinking of having a local variable and pass to the to function which actually corrupts data , So the iter is not corrupted rather the local variable which we used is corrupted. So after the timeout based on the value of iter , the iteration is done and will be done properly . So this is my requirement , probably we may not require whole linked list to be copied to the local variable in case , please share your ideas on the same and how can we achieve it
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

any idea to copy directory structure

I want to copy the durectory structure having subdirectories in it ... would be greatful if anyone could let me know .. thanks in advance (6 Replies)
Discussion started by: myelvis
6 Replies

2. UNIX for Dummies Questions & Answers

copy files with directory structure

i have a text file as. /database/sp/NTR_Update_Imsi_List.sql /database/sp/NTR_Update_Imsi_Range_List.sql /database/sp/NTR_Vlr_Upload.sql /database/tables/StatsTables.sql /mib/ntr.mib /mib/ntr.v2.mib /scripts/operations/ntr/IMSITracer.ph /scripts/operations/ntr/IMSITracer.pl ... (3 Replies)
Discussion started by: adddy
3 Replies

3. Shell Programming and Scripting

Recursion to Copy a Directory structure

I have the below code to recurse through a given file path. I am able to go to the leaf level once recursively but traversing out is not possible as the required varaibles don't have the values on return. Both typeset and local don't work for my variable definitions. I have the o/p of the sample... (2 Replies)
Discussion started by: avrkiran
2 Replies

4. Shell Programming and Scripting

copy directory structure to a system on the network

I am trying to write a script which has to copy the directory structure from my system to another system on the network. But I dont want the files to be copied. I think I have to start with copying all subdirectories names in a directory to a system on the network. Here's the case: Source... (1 Reply)
Discussion started by: firefox211
1 Replies

5. Shell Programming and Scripting

Copy only folder structure ?

Hello, I am not sure how feasible is it, but trying to copy/create the folders from one box to another. I dont want to copy the content of folder otherwise it'd be too much of data.. The folder structure is quite complex (in deep hierarchy) and its a big effort manually .. Please... (5 Replies)
Discussion started by: navsha
5 Replies

6. Shell Programming and Scripting

Copy a file by creating folder structure in destination as in Souce

Hello, i am having a source directory which consist of multiple sub directories and my destination folder is a empty directory. if try to copy a file source->test->1.txt from source to destination test2 using the commaind. cp source/test/1.txt desti/ It will copy the 1.txt under desti... (1 Reply)
Discussion started by: tsaravanan
1 Replies

7. UNIX for Advanced & Expert Users

Copy Structure excluding some folders

Hi I want to copy the structure from one place to another. -> cd /hol/; -> find . -type d | cpio -pvdm /abc/cat; while copying the structure I want to exclude some directories like test1 and Test. I have read somewhere that this can be done with -prune option. Could anyone... (2 Replies)
Discussion started by: soumodeep123
2 Replies

8. Shell Programming and Scripting

Copy files from input file with dir structure

hi, I want to copy files from source directory based on input file (or output of previous command) and i want to have the SAME DIRECTORY STRUCTURE. Note that i will have other files and directories which i dont want to copy to destination. For example, dir source has following content:... (22 Replies)
Discussion started by: dragon.1431
22 Replies

9. Shell Programming and Scripting

Need to copy a directory structure from one server to another

Hello All, I have got a dev server and a production server will call it as D server and P server. I have a dir structure in my D server and i need to create the same dir structure in P server also using a shell script. If i do a find . in my D server, i am getting an o/p like :- . ./vio... (9 Replies)
Discussion started by: Renjesh
9 Replies

10. Shell Programming and Scripting

How to copy all structure folder create last day?

HI All, please help , i got same case . i want copy folder and directory create yesterday. for sample below : drwxr-xr-x 4 apps apps 33 Nov 23 04:00 xxxxxx@gmai.com drwxr-xr-x 4 apps apps 33 Nov 23 04:00 yyyyyyy@gmail.com drwxr-xr-x 4 apps apps 33 Nov 24 04:00... (2 Replies)
Discussion started by: fajar_3t3
2 Replies
ping_iterator_get(3)						     liboping						      ping_iterator_get(3)

NAME
ping_iterator_get, ping_iterator_next - Iterate over all hosts of a liboping object SYNOPSIS
#include <oping.h> pingobj_iter_t *ping_iterator_get (pingobj_t *obj); pingobj_iter_t *ping_iterator_next (pingobj_iter_t *iter) DESCRIPTION
These two functions can be used to iterate over all hosts associated with a liboping object. You can use these methods as follows: pingobj_iter_t *iter; for (iter = ping_iterator_get (obj); iter != NULL; iter = ping_iterator_next (iter)) { ...; } To get usable information from an iterator object (which is also an opaque data type, just like the liboping object itself) use ping_iterator_get_info(3) and ping_iterator_get_context(3). RETURN VALUE
The ping_iterator_get returns an iterator for obj or NULL if no host is associated with obj. The ping_iterator_next returns an iterator for the host following iter or NULL if the last host has been reached. SEE ALSO
ping_host_add(3), ping_iterator_get_info(3), ping_iterator_get_context(3), liboping(3) AUTHOR
liboping is written by Florian "octo" Forster <octo at verplant.org>. Its homepage can be found at <http://verplant.org/liboping/>. Copyright (c) 2005-2011 by Florian "octo" Forster. 1.6.2 2012-01-31 ping_iterator_get(3)
All times are GMT -4. The time now is 10:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy