Sponsored Content
Top Forums Programming Pure C function pointer on printing vowels twice Post 302997637 by yifangt on Wednesday 17th of May 2017 03:21:15 PM
Old 05-17-2017
Is there another layer hidden behind for printing with putchar() in the if-condition?

The return value is EOF or a single vowel, which is the first part bugging me.

Does that mean in if (putchar(c) == EOF || putchar(c) == EOF) , function putchar(c) gets actually executed twice?

I thought this line is just a condition, and before the end only the else block is executed so that the value is 'e', without printing.
Let me put my question in another way:
Is there another layer for printing hidden behind, such as when 'e' is encountered in 'Test'?
Code:
putchar(c);    //Is this the place 'e' get printed the first time?
left ~> (putchar(e) == EOF) is false, 0
putchar(c);    //Is this the place 'e' get printed the second time?
right ~> (putchar(e) == EOF is false, 0
so that, the if (0 || 0) condition still false; 
else block executed

Is this correct?
Thanks!

Last edited by yifangt; 05-17-2017 at 04:26 PM..
 

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

Pure Virtual Function in C++

Dear All, Here I want to know why we put =0 in case of pure virtual function, why not =1, =2 or any thing else Please send me answer any one as soon as possible. (1 Reply)
Discussion started by: krishna_sicsr
1 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. 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

5. Programming

Function Returning Pointer

Hi guys. how a functions such fdopen, ... can return pointer? are these functions use static memory(variables)? (6 Replies)
Discussion started by: majid.merkava
6 Replies

6. UNIX for Dummies Questions & Answers

Printing pointer address

How can I print the memory address of a pointer using printf (or any other STDOUT functions?). I see in Linux its %p but not in unix, help? thanks (5 Replies)
Discussion started by: perleo
5 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. UNIX for Dummies Questions & Answers

Counting vowels in string. "Comparison pointer-integer".

I'm trying to write a programme which scans strings to find how many vowels they contain. I get an error saying that I'm trying to compare a pointer and an integer inif(*v == scanme){. How can I overcome this ? Also, the programme seems to scan only the first word of a string e.g.: if I type "abc... (1 Reply)
Discussion started by: fakuse
1 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
pure-pw(8)							     Pure-FTPd								pure-pw(8)

NAME
pure-pw - Manage virtual users files for Pure-FTPd SYNTAX
pure-pw useradd login [-f passwd_file] [-F puredb_file] -u uid [-g gid] -D/-d home_directory [-c gecos] [-t download_bandwidth] [-T upload_bandwidth] [-n max number_of_files] [-N max_Mbytes] [-q upload_ratio] [-Q download_ratio] [-r <allow client host>/<mask>[,<ip>/<mask>]...] [-R <deny client host>/<mask>[,<ip>/<mask>]...] [-i <allow local host>/<mask>[,<ip>/<mask>]...] [-I <deny local host>/<mask>[,<ip>/<mask>]...] [-y <max number of concurrent sessions>] [-z <hhmm>-<hhmm>] [-m] pure-pw usermod login [-f passwd_file] [-F puredb_file] [-u uid] [-g gid] -D/-d home_directory -[c gecos] [-t download_bandwidth] [-T upload_bandwidth] [-n max_number_of_files] [-N max_Mbytes] [-q upload_ratio] [-Q download_ratio] [-r <allow client host>/<mask>[,<ip>/<mask>]...] [-R <deny client host>/<mask>[,<ip>/<mask>]...] [-i <allow local host>/<mask>[,<ip>/<mask>]...] [-I <deny local host>/<mask>[,<ip>/<mask>]...] [-y <max number of concurrent sessions>] [-z <hhmm>-<hhmm>] [-m] pure-pw userdel login [-f passwd_file] [-F puredb_file] [-m] pure-pw passwd login [-f passwd_file] [-F puredb_file] [-m] pure-pw show login [-f passwd_file] [-m] pure-pw mkdb [<puredb_database_file> [-f passwd_file]] [-F puredb_file] pure-pw list [-f passwd_file] DESCRIPTION
Virtual users is a simple mechanism to store a list of users, with their password, name, uid, directory, etc. It's just like /etc/passwd. But it's not /etc/passwd. It's a different file, only for FTP. It means that you can easily create FTP-only accounts without messing your system accounts. Additionnaly, virtual users files can store individual quotas, ratios, bandwidth, etc. System accounts can't do this. Thousands of virtual users can share the same system user, as long as they all are chrooted, and they have their own home directory. FILES
/etc/pure-ftpd/pureftpd.passwd /etc/pure-ftpd/pureftpd.pdb ENVIRONMENT VARIABLES
PURE_PASSWDFILE If this variable is defined, this is the default value for the text password file. Without this variable, /etc/pure- ftpd/pureftpd.passwd is assumed. PURE_DBFILE If this variable is defined, this is the default value for the PureDB password file. Without this variable, /etc/pure- ftpd/pureftpd.pdb is assumed. EXAMPLES
Please read http://download.pureftpd.org/pub/pure-ftpd/doc/README.Virtual-Users AUTHORS
Frank DENIS <j at pureftpd dot org> SEE ALSO
ftp(1), pure-ftpd(8) pure-ftpwho(8) pure-mrtginfo(8) pure-uploadscript(8) pure-statsdecode(8) pure-pw(8) pure-quotacheck(8) pure-authd(8) RFC 959, RFC 2228, RFC 2389 and RFC 2428. Pure-FTPd team 1.0.36 pure-pw(8)
All times are GMT -4. The time now is 04:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy