Sponsored Content
Full Discussion: writing functions
Top Forums Programming writing functions Post 302264959 by otheus on Friday 5th of December 2008 08:12:05 AM
Old 12-05-2008
When you call apply_discount, you are trying to store the result in a character value (dis_count). So the compiler is looking for a function named "apply_discount" that returns a character, but you have one that returns a double.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regarding functions

Hi, I have a function or script like this. show() { echo "Hi" } | tee -a log show This creates a logfile and prints Hi in it. Now when I try to do the same for sql like this: show() { sqlplus -s scott/tiger<<! select * from details; ! } | tee -a log show Then it gives me a... (2 Replies)
Discussion started by: sendhilmani
2 Replies

2. Shell Programming and Scripting

functions in

hi could anybody please suggest me how to put a function memory for particular user. say i am a user rao. want have a function foo in memory . i have done this .typed the function function in the shell it worked for the session.but next time i do login its not there . i can i have a... (6 Replies)
Discussion started by: Raom
6 Replies

3. Shell Programming and Scripting

Use of functions

Hi my shell is tcsh can I have functions in my shell scripting? Is the below shell script correct. Can I have two functions and call one of them as required. ---------- echo "functions" f1 f1 () { echo "hello" } f2 () (1 Reply)
Discussion started by: amitrajvarma
1 Replies

4. Shell Programming and Scripting

functions

I have korn shells where I want to create a function passing $1 to a function , determine my $STAT_ENV value, set the paths and return the paths for STATSH,STATPRM,STATSQR,STATSQL,STATCTL TO BE USED IN THE UNIX SCRIPT THE CALLED THE fucnction in the first place. Can someone tell me the best... (2 Replies)
Discussion started by: TimHortons
2 Replies

5. UNIX for Dummies Questions & Answers

Help with functions

Hi, I am exploring with defining functions in my BASH shell scripts. However, I am bit confused about how to pass parameters to my functions. I was under the impression that you must do something like the following: Define a function called "sample_function": function sample_function {... (3 Replies)
Discussion started by: msb65
3 Replies

6. Shell Programming and Scripting

i think i need functions ?

Hi, im making a little script but need some help Code i have so far is read -p 'Bot Nickname:' ecnick read -p 'Bot Username:' ecusername read -p 'Bot Realname:' ecrealname read -p 'Your Email:' ecemail echo '' echo Your bots nickname is set to $ecnick echo Your bots username is set to... (2 Replies)
Discussion started by: Gemster
2 Replies

7. UNIX for Dummies Questions & Answers

== vs -eq and functions

Hey I have a question.... what is the difference between using == vs -eq when testing in WHILE loops. I use the following test that only worked with == signs.... if why do i need == and not -eq? 2. I need to re-use some code in a couple places in this script. is functions my best... (5 Replies)
Discussion started by: danieldcc
5 Replies

8. Programming

Functions

Hi All, Can any one help me. I am calling in a function2 with string as parameter from function1, the function1 gives 3 values. how i get the 3 values from funciton2 to function1. i have to give a return or something. thanks in advance. (2 Replies)
Discussion started by: uday.sena.m
2 Replies

9. Programming

Writing C++ class and member functions

I have the following class and thought that when I call the set command to set a member, I always use value. Would that be fine? class ModMisfit { protected: Real dtau; Real mdacc; Real mindist; bool hw; Source** src; public: void ... (7 Replies)
Discussion started by: kristinu
7 Replies

10. Shell Programming and Scripting

How to execute functions or initiate functions as command line parameters for below requirement?

I have 7 functions those need to be executed as command line inputs, I tried with below code it’s not executing function. If I run the ./script 2 then fun2 should execute , how to initiate that function I tried case and if else also, how to initiate function from command line if then... (8 Replies)
Discussion started by: saku
8 Replies
RUNE(3) 						   BSD Library Functions Manual 						   RUNE(3)

NAME
setrunelocale, setinvalidrune, sgetrune, sputrune, fgetrune, fungetrune, fputrune -- rune support for C LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <rune.h> #include <errno.h> int setrunelocale(char *locale); void setinvalidrune(rune_t rune); rune_t sgetrune(const char *string, size_t n, char const **result); int sputrune(rune_t rune, char *string, size_t n, char **result); #include <stdio.h> long fgetrune(FILE *stream); int fungetrune(rune_t rune, FILE *stream); int fputrune(rune_t rune, FILE *stream); DESCRIPTION
The 4.4BSD ``rune'' functions have been deprecated in favour of the ISO C99 extended multibyte and wide character facilities and should not be used in new applications. Consider using setlocale(3), mbrtowc(3), wcrtomb(3), fgetwc(3), ungetwc(3), and fputwc(3) instead. The setrunelocale() controls the type of encoding used to represent runes as multibyte strings as well as the properties of the runes as defined in <ctype.h>. The locale argument indicates which locale to load. If the locale is successfully loaded, 0 is returned, otherwise an errno value is returned to indicate the type of error. The setinvalidrune() function sets the value of the global value _INVALID_RUNE to be rune. The sgetrune() function tries to read a single multibyte character from string, which is at most n bytes long. If sgetrune() is successful, the rune is returned. If result is not NULL, *result will point to the first byte which was not converted in string. If the first n bytes of string do not describe a full multibyte character, _INVALID_RUNE is returned and *result will point to string. If there is an encoding error at the start of string, _INVALID_RUNE is returned and *result will point to the second character of string. the sputrune() function tries to encode rune as a multibyte string and store it at string, but no more than n bytes will be stored. If result is not NULL, *result will be set to point to the first byte in string following the new multibyte character. If string is NULL, *result will point to (char *)0 + x, where x is the number of bytes that would be needed to store the multibyte value. If the multibyte character would consist of more than n bytes and result is not NULL, *result will be set to NULL. In all cases, sputrune() will return the number of bytes which would be needed to store rune as a multibyte character. The fgetrune() function operates the same as sgetrune() with the exception that it attempts to read enough bytes from stream to decode a sin- gle rune. It returns either EOF on end of file, _INVALID_RUNE on an encoding error, or the rune decoded if all went well. The fungetrune() function pushes the multibyte encoding, as provided by sputrune(), of rune onto stream such that the next fgetrune() call will return rune. It returns EOF if it fails and 0 on success. The fputrune() function writes the multibyte encoding of rune, as provided by sputrune(), onto stream. It returns EOF on failure and 0 on success. RETURN VALUES
The setrunelocale() function returns one of the following values: 0 The setrunelocale() function was successful. [EINVAL] The locale name was incorrect. [ENOENT] The locale could not be found. [EFTYPE] The file found was not a valid file. The sgetrune() function either returns the rune read or _INVALID_RUNE. The sputrune() function returns the number of bytes needed to store rune as a multibyte string. FILES
$PATH_LOCALE/locale/LC_CTYPE /usr/share/locale/locale/LC_CTYPE binary LC_CTYPE file for the locale locale. SEE ALSO
mbrune(3), setlocale(3), euc(4), utf2(4), utf8(5) HISTORY
These functions first appeared in 4.4BSD. The setrunelocale() function and the other non-ANSI rune functions were inspired by Plan 9 from Bell Labs. BSD
October 6, 2002 BSD
All times are GMT -4. The time now is 05:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy