03-06-2010
Passing struct through unix pipe -solved
EDIT: Nevermind, called a friend who is good at this stuff and he figured it out
Hi all,
So I'm trying to teach myself to write programs for unix in c. I am currently creating a program, and I need to pass a struct through a pipe, but I can't figure out how.
The struct I want to pass has two types in it, one enum and one union of two other structs. These two other structs each contain an int and a char variablename[256] array.
gcc won't let me just pass the struct using write(pipefd[1], struct, size_of_struct) since the struct is not a char buffer. So that's my question...how does one go about passing a struct?
Thanks!
EDIT: Nevermind, called a friend who is good at this stuff and he figured it out
Last edited by twnsfn34; 03-06-2010 at 10:51 PM..
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I write kernel module with kernel threads using
linux/kthread.h on 2.6.* kernel
I tried to passing data between two kernel threads
with data argument of kthread_run( fun, data , NAME );
but this is not work I dont know why. I tried many possibility
and nothing works.
So I thought that... (0 Replies)
Discussion started by: marcintom
0 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I want to check a particular word is in standard error output or not. Can I acheive it in single command?
For example,
Delete file_name 2>error.log
cat error.log
Output:
XXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX
Successfully deleted
XXXXXXXXXXXXXXXXX
where delete is... (2 Replies)
Discussion started by: poova
2 Replies
3. UNIX for Dummies Questions & Answers
Can someone tell me how to do this?
Just a thought that entered my mind when learning about structs.
First thought was:
struct one
{
struct two;
}
struct two
{
three;
}
one->two->three
would this be how you would access "three"? (1 Reply)
Discussion started by: unbelievable21
1 Replies
4. Homework & Coursework Questions
Hi, i'm trying to copy a struct into a binary file using the unix instruction write, so i declare and fill the struct "superbloque" in one function "initSB" and then i pass the pointer to another function called bwrite (for block write) which calls write. The problem is that i call the function... (2 Replies)
Discussion started by: ignatius3
2 Replies
5. Programming
I am trying to work out the best syntax for a relatively simple operation. The goal is to declare an instance of a struct and pass it around to be populated and have the data manipulated. There is an extra wrinkle in that the functions are in different src files.
The main is simple,
#include... (5 Replies)
Discussion started by: LMHmedchem
5 Replies
6. Programming
Hi,
I have received an application that stores some properties in a file. The existing struct looks like this:
struct TData
{
UINT uSizeIncludingStrings;
// copy of Telnet data struct
UINT uSize;
// basic properties:
TCHAR szHost; //defined in Sshconfig
UINT iPortNr;
TCHAR... (2 Replies)
Discussion started by: Powerponken
2 Replies
7. Programming
this is my code to try and prinnt out a deck of cards. the print function worked when used inside main without being a function but now i cant get it to work as a function probably since i dont know how to pass a struct array in c. I gave it a shot but i keep getting an assortment of errors. The... (0 Replies)
Discussion started by: bjhum33
0 Replies
8. Shell Programming and Scripting
I have a file data_1.out which contains:
1|abc mail|mail subject|mail body
2|def mail|mail subject|def mail body
I am trying to read the variables from data_1.out and use them to print to 2 different files based on the id (first_column)
The problem is I am not able to read the file... (8 Replies)
Discussion started by: sol_nov
8 Replies
9. UNIX for Dummies Questions & Answers
I have file like below
1|4|OR|OLAP|INT|INT||CONSTANT|2012/08/07|9999/12/31|0|0|0|0|PRL|-358.1684563||||||||||36522|55791|LNR|
2|4|OR|OLAP|CLR|CLR||CONSTANT|2012/09/07|9999/12/31|0|0|0|0|PRL|-358.1684563||||||||||36522|57891|REGS|... (2 Replies)
Discussion started by: gkskumar
2 Replies
10. UNIX for Beginners Questions & Answers
Dear UNIX forum members,
I am using macbook pro 13 (2015 edition) with MAC OS Mojave and am trying to write the shell script where when it is run through terminal it asks for an input (in the code below an input variable is domains) and then that input becomes capital letter or letters which... (3 Replies)
Discussion started by: Aurimas
3 Replies
LEARN ABOUT DEBIAN
exo-desktop-item-edit
EXO-DESKTOP-ITEM-EDIT(1) User Commands EXO-DESKTOP-ITEM-EDIT(1)
NAME
exo-desktop-item-edit - Create icons on the desktop
DESCRIPTION
Usage:
exo-desktop-item-edit [OPTION...] [FILE|FOLDER]
Help Options:
-?, --help
Show help options
--help-all
Show all help options
--help-gtk
Show GTK+ Options
Application Options:
-c, --create-new
Create a new desktop file in the given directory
-t, --type
Type of desktop file to create (Application or Link)
--name Preset name when creating a desktop file
--comment
Preset comment when creating a desktop file
--command
Preset command when creating a launcher
--url Preset URL when creating a link
--icon Preset icon when creating a desktop file
-v, --version
Print version information and exit
--display=DISPLAY
X display to use
AUTHOR
Written by Benedikt Meurer <benny@xfce.org>.
exo-desktop-item-edit comes with ABSOLUTELY NO WARRANTY, You may redistribute copies of exo-desktop-item-edit under the terms of the GNU
Lesser General Public License which can be found in the exo source package.
Please report bugs to <http://bugzilla.xfce.org/>.
COPYRIGHT
Copyright (C) 2005-2006
os-cillation e.K. All rights reserved.
SEE ALSO
The full documentation for exo-desktop-item-edit is maintained as a Texinfo manual. If the info and exo-desktop-item-edit programs are
properly installed at your site, the command
info exo-desktop-item-edit
should give you access to the complete manual.
exo-desktop-item-edit 0.3.1.10rc1 September 2006 EXO-DESKTOP-ITEM-EDIT(1)