Sponsored Content
Full Discussion: Function Returning Pointer
Top Forums Programming Function Returning Pointer Post 302506800 by majid.merkava on Tuesday 22nd of March 2011 02:40:37 AM
Old 03-22-2011
Function Returning Pointer

Hi guys.

how a functions such fdopen, ... can return pointer?
are these functions use static memory(variables)?
 

10 More Discussions You Might Find Interesting

1. Programming

Problem with function which reutrns pointer to a value

i have a function: char *pcCityIdToCountryName(ADMIN_DB_DATA *pstHEader, unit uiCityID) this returns a pointer to CountryName if cityId is given. to retrieve countryname i give: char *CountryName; CountryName = pcCityIdToCountryName(..................); but when i compile it is giving :... (5 Replies)
Discussion started by: jazz
5 Replies

2. Programming

string returning function

I have two string returning function in ESQL/C char *segment_name(lbuffer) char *lbuffer; {..... and char *get_bpdvalue(f_name) char *f_name; {...... both declared above main() char *get_bpdvalue(); char *segment_name(); my problem is segment_name works on sprintf and strcpy... (5 Replies)
Discussion started by: jisc
5 Replies

3. Programming

How to return void function pointer

Hello all im trying to build function that will return void function pointer what is mean is ( not working ) the main function void * myClass::getFunction(int type){ if(type==1) return &myClass::Test1; if(type==2) return &myClass::Test2; } void myClass::Test1(){... (1 Reply)
Discussion started by: umen
1 Replies

4. Shell Programming and Scripting

returning from a function

Hi all, I am very new to BASH shell programming. I need to return an integer from a function to the caller function. I did this: but it keeps giving me wrong return: Can someone help me out here, please? Thanks (2 Replies)
Discussion started by: alirezan
2 Replies

5. Shell Programming and Scripting

Returning the name of function used

Hi All In my script, I can call on several functions. I have a logging function that is called by any of these functions. What I would like is some way of identifying which function I am using and pass this to the log function as some parameter. Is there some built in command or way of... (3 Replies)
Discussion started by: kingpin2502
3 Replies

6. Programming

Function pointer to inline function ?

Hi. Problem: I have to parse the payload of a packet. The payload could be in Big Endian Format (network byte order) or little. That depends on a flag present in the header of the packet. Solution: A horrible solution could be to check for that flag everytime I have to read a field in the... (11 Replies)
Discussion started by: emitrax
11 Replies

7. Programming

structure pointer array as function parameters

if i create an array of pointers to a structure "struct node" as: struct node *r; and create "n" number of "linked lists" and assign it to the various struct pointers r using some function with a return type as structure pointer as: r=multiplty(.......) /*some parameters*/ is... (2 Replies)
Discussion started by: mscoder
2 Replies

8. Programming

Trivial doubt about C function pointer

Hi, In the below C code, #include <stdio.h> void print() { printf("Hello\n"); } int main() { void (*f)() = (void (*)()) print; f(); (*f)(); } I wonder, how the syntaxes "f()" and "(*f)()" are treated as same without any error? Is this an improvement or ANSI/ISO... (1 Reply)
Discussion started by: royalibrahim
1 Replies

9. Programming

Pure C function pointer on printing vowels twice

Have difficulty to understand this pure C code to only print vowels twice from input string. Questions are commented at the end of each place. #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <limits.h> /* *Demonstrate the use of dispatch tables */ /*Print a char... (11 Replies)
Discussion started by: yifangt
11 Replies

10. Programming

Segmentation fault when I pass a char pointer to a function in C.

I am passing a char* to the function "reverse" and when I execute it with gdb I get: Program received signal SIGSEGV, Segmentation fault. 0x000000000040083b in reverse (s=0x400b2b "hello") at pointersExample.c:72 72 *q = *p; Attached is the source code. I do not understand why... (9 Replies)
Discussion started by: jose_spain
9 Replies
fdopen(3C)																fdopen(3C)

NAME
fdopen - associate a stream with a file descriptor SYNOPSIS
#include <stdio.h> FILE *fdopen(int fildes, const char *mode); The fdopen() function associates a stream with a file descriptor fildes. The mode argument is a character string having one of the following values: r or rb Open a file for reading. w or wb Open a file for writing. a or ab Open a file for writing at end of file. r+, rb+ or r+b Open a file for update (reading and writing). w+, wb+ or w+b Open a file for update (reading and writing). a+, ab+ or a+b Open a file for update (reading and writing) at end of file. The meaning of these flags is exactly as specified for the fopen(3C) function, except that modes beginning with w do not cause truncation of the file. The mode of the stream must be allowed by the file access mode of the open file. The file position indicator associated with the new stream is set to the position indicated by the file offset associated with the file descriptor. The fdopen() function preserves the offset maximum previously set for the open file description corresponding to fildes. The error and end-of-file indicators for the stream are cleared. The fdopen() function may cause the st_atime field of the underlying file to be marked for update. If fildes refers to a shared memory object, the result of the fdopen() function is unspecified. Upon successful completion, fdopen() returns a pointer to a stream. Otherwise, a null pointer is returned and errno is set to indicate the error. The fdopen() function may fail and not set errno if there are no free stdio streams. The fdopen() function may fail if: EBADF The fildes argument is not a valid file descriptor. EINVAL The mode argument is not a valid mode. EMFILE {FOPEN_MAX} streams are currently open in the calling process. {STREAM_MAX} streams are currently open in the calling process. ENOMEM There is insufficient space to allocate a buffer. USAGE
A process is allowed to have at least {FOPEN_MAX} stdio streams open at a time. For 32-bit applications, however, the underlying ABIs for- merly required that no file descriptor used to access the file underlying a stdio stream have a value greater than 255. To maintain binary compatibility with earlier Solaris releases, this limit still constrains 32-bit applications. File descriptors are obtained from calls like open(2), dup(2), creat(2) or pipe(2), which open files but do not return streams. Streams are necessary input for almost all of the standard I/O library functions. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ creat(2), dup(2), open(2), pipe(2), fclose(3C), fopen(3C), attributes(5), standards(5) 18 May 2005 fdopen(3C)
All times are GMT -4. The time now is 02:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy