Sponsored Content
Homework and Emergencies Homework & Coursework Questions FIFO possible blocking or unknown error Post 302444780 by Corona688 on Thursday 12th of August 2010 07:04:27 PM
Old 08-12-2010
Code:
...
    #undef FIFOSERVER
    #undef FIFOCLIENT
    #define FIFOSERVER fifoNames[1]
    #define FIFOCLIENT fifoNames[2]

#define's are, more or less, literal text replacement operators that happen even before the program is compiled.

For example:

Code:
#define A  FUNCTION_A

A();

void function_c()
{
        A();
}

#undef A
#define A FUNCTION_B
A();

function_c();

When you compile it, the first step it does is preprocessing, which does the text replacement, reducing the code to this:

Code:
FUNCTION_A();

void function_c()
{
        A();
}

FUNCTION_B();

function_c();

meaning function_c calls FUNCTION_A, not FUNCTION_B. So, this text replacement cannot do any logic at runtime. All decisions it makes happen right when the code is compiled. If you want to change what files your function opens, pass it parameters so you can tell it so:
Code:
void chatty(const char *rdfile, const char *wrfile)
{
        ...
}

...


chatty(fifonames[0], fifonames[1]);

...

chatty(fifonames[1], fifonames[0]);

 

10 More Discussions You Might Find Interesting

1. Programming

Error: unknown pseudo-op: `.weakref'

It's really strange that I have these error messages as follows when I tried to compile the C++ program. g++ -c -pipe -DOpenModeType=std::_Ios_Openmode -g -I. -o Obj/NP_genome_info.o NP_genome_info.cpp {standard input}: Assembler messages: {standard input}:10: Error: unknown pseudo-op:... (6 Replies)
Discussion started by: napapanbkk
6 Replies

2. Shell Programming and Scripting

Reading from blocking fifo pipe in shell script

Hi!! I have a problem reading from a fifo pipe in shell script. The idea is simple, I have a C program with two pipe files: An input pipe I use to send commands in shell script to the C program (echo "command" > input.pipe) An output pipe that I read the result of the command also in... (4 Replies)
Discussion started by: victorin
4 Replies

3. Solaris

Unknown File Type error

Greetings there, i was trying to install an eclipse plugin on sunOS 4.x for the solaris sparc platform, and i got the following error: /usr/project/RAServer/bin> ./RAStart.sh Starting Agent Controller ld.so.1: RAServer: fatal: /usr/project/RAServer/lib/libxerces-c.so.24: unknown file type... (3 Replies)
Discussion started by: rohitsz
3 Replies

4. Shell Programming and Scripting

syntax error in shell test: unknown operator

Hi All, can some one figure out the syntax issue here. How to overcome this? #!/bin/sh $ HFR_MAIL=NO $ PRP_MAIL=NO $ MC_MAIL=NO $ if && && ]; then > echo "NO " > else > echo "YES" > fi test: unknown operator NO $ if && && ]; then > echo "NO" > else > echo "YES" >... (4 Replies)
Discussion started by: shellscripter
4 Replies

5. Shell Programming and Scripting

Unknown error - ``' unmatched

Hi Guys, I get the error while running below commands. Earlier the command used to execute, but after enclosing them in a function, the error is occuring backupPath=`echo $folderName | sed -e 's,/vobs/dte/itgClient/client/RegressionTestLibPostOHS/,,'` check_event=`cat... (7 Replies)
Discussion started by: ajincoep
7 Replies

6. Programming

Help Unknown Syntax Error

Please excuse me if this is an easy fix, for I am new to Unix and C '/problem1.c: line2: syntax error near unexpected token ` '/problem1.c: line2: `main() and for one program it has : command not found2: (above the syntax error) As mentioned this is in C not C++, I have complied all... (3 Replies)
Discussion started by: apolo93
3 Replies

7. UNIX for Advanced & Expert Users

Using SFTP Error Server Unknown

Not sure if this is the right forum and I apologies if not. I use Expression web to update our website on a UNIX server using SFTP. I use the same laptop, software, that works fine when at home, but when I travel, I tend to get a unknown server error. I am suspecting that it has something to do... (2 Replies)
Discussion started by: ae3799t
2 Replies

8. Solaris

SMTP Server 550 5.1.1 User unknown Error

Hello All, I am currently running a Solaris 10 machine as inbound SMTP server i.e. bringing Emails from outside into our company. In /var/spool/mqueue , I have mails that are pending for the past 4-5 days. They are not being delivered and are causing my mount point size to increase. Error... (0 Replies)
Discussion started by: Junaid Subhani
0 Replies

9. Programming

Which are blocking and non-blocking api's in sockets in C ?

among the below socket programming api's, please let me know which are blocking and non-blocking. socket accept bind listen write read close (2 Replies)
Discussion started by: VSSajjan
2 Replies

10. Shell Programming and Scripting

Getting unknown operator error while using a function

Hi, I wrote a function for the first time and not able to get the desired result. I have requirement to execute 10 queries. For this i wrote a function like below. function Command { typeset var SOL; if ; then CONNECTION="${CONNECTION} -e -time"; else SOL="`nzsql ${CONNECTION} -c... (8 Replies)
Discussion started by: Samah
8 Replies
LIBXO(3)						   BSD Library Functions Manual 						  LIBXO(3)

NAME
xo_err -- emit errors and warnings in multiple formats LIBRARY
library ``libxo'' SYNOPSIS
#include <libxo/xo.h> void xo_warn(const char *fmt, ...); void xo_warnx(const char *fmt, ...); void xo_warn_c(int code, const char *fmt, ...); void xo_warn_hc(xo_handle_t *xop, int code, const char *fmt, ...); void xo_err(int eval, const char *fmt, ...); void xo_errc(int eval, int code, const char *fmt, ...); void xo_errx(int eval, const char *fmt, ...); void xo_message(const char *fmt, ...); void xo_message_c(int code, const char *fmt, ...); void xo_message_hc(xo_handle_t *xop, int code, const char *fmt, ...); void xo_message_hcv(xo_handle_t *xop, int code, const char *fmt, va_list vap); DESCRIPTION
Many programs make use of the standard library functions err(3) and warn(3) to generate errors and warnings for the user. libxo wants to pass that information via the current output style, and provides compatible functions to allow this. These functions display the program name, a colon, a formatted message based on the arguments, and then optionally a colon and an error mes- sage associated with either errno or the code parameter. EXAMPLE: if (open(filename, O_RDONLY) < 0) xo_err(1, "cannot open file '%s'", filename); ADDITIONAL DOCUMENTATION
Complete documentation can be found on github: http://juniper.github.io/libxo/libxo-manual.html libxo lives on github as: https://github.com/Juniper/libxo The latest release of libxo is available at: https://github.com/Juniper/libxo/releases SEE ALSO
xo_emit(3) HISTORY
The libxo library was added in FreeBSD 11.0. AUTHOR
Phil Shafer BSD
December 4, 2014 BSD
All times are GMT -4. The time now is 02:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy