06-14-2010
yes showkat, but you have a magic number for the loop.
i.e. 6.
that is not good practice.
so if you edit the initialiser you have to remember to change the loop number.
my method or the NULL method is the safe way to traverse an array.
10 More Discussions You Might Find Interesting
1. Programming
hi all,
let say i have a pointer exit, and this exit will store some value. how can i store the value that the pointer points to into an array and then print them out from the array.
thanks in advance (2 Replies)
Discussion started by: dianazheng
2 Replies
2. UNIX for Dummies Questions & Answers
I'm pretty new at this UNIX stuff, and this may be a simple question but I'm kind of stuck :confused:
Let's say I have a large directory structure of .essay files,
where I saved all of the essays that I did over the last few years. Not all of the .essay files are in the same directory (all... (1 Reply)
Discussion started by: hooj
1 Replies
3. Programming
Hi
i have the following structure
struct S
{
char Mod_num;
char val;
char chr_nm_cd;
}
I am reading a 2GB file and inserting into the structure and writing into a vector.
I feel like only vector will be a right option. I tried with multimap but it is memory intensive and hence i... (1 Reply)
Discussion started by: dhanamurthy
1 Replies
4. UNIX for Dummies Questions & Answers
hi
please suggest a korn script which will traverse all subdirectory in the current directory? (2 Replies)
Discussion started by: ilayans
2 Replies
5. Programming
Hi All,
I am using the array of pointers and storing the address of string.This is a global list.
So i am using extern to give the reference of this list to another file and using reading the data from this string.
But list is being corrupted and string is missing some characters in... (2 Replies)
Discussion started by: lovevijay03
2 Replies
6. Homework & Coursework Questions
I was given to create a backup of all files in a given directory(command line argument) into say /home/vishal/back and the back up files must be accordingly to the extension of the file i.e pdf files are saved in back/pdf doc files back/doc etc . I gave a recursive function to traverse through the... (1 Reply)
Discussion started by: davis7son
1 Replies
7. Shell Programming and Scripting
I am writing a script which will read a word and say how many vowels and consonants does the word contain. but i dont know how to traverse a string in shell scripting. if it was in C i'd have done something like this:
cout<<"plz enter the word"<<endl;
cin>>word;
int consonants, vowels;... (4 Replies)
Discussion started by: nishrestha
4 Replies
8. Programming
Hello, I read from a book exercise for a challenge. How to print out each letter of char array a by two different pointers pa and ppa in the example?
I have tried my code for letter "r" by testing without full understanding as only the first one worked.
#include<stdio.h>
int main()
{
char... (17 Replies)
Discussion started by: yifangt
17 Replies
9. Programming
Hello,
I want to loop thru a vector composed of many entries as structure, which contains sequenceID and sequence. At looping, delete any structure if the sequence is a perfect-match substring of another sequence of any other structure, so that the resulted vector contains only unique sequences.... (1 Reply)
Discussion started by: yifangt
1 Replies
10. Programming
I am attempting to create an array of function pointers. The examples I follow to do this are from:
support.microsoft.com/en-us/help/30580/how-to-declare-an-array-of-pointers-to-functions-in-visual-c
... (3 Replies)
Discussion started by: spflanze
3 Replies
LEARN ABOUT DEBIAN
io::async::loop::epoll
IO::Async::Loop::Epoll(3pm) User Contributed Perl Documentation IO::Async::Loop::Epoll(3pm)
NAME
IO::Async::Loop::Epoll - use "IO::Async" with "epoll" on Linux
SYNOPSIS
use IO::Async::Loop::Epoll;
use IO::Async::Stream;
use IO::Async::Signal;
my $loop = IO::Async::Loop::Epoll->new();
$loop->add( IO::Async::Stream->new(
read_handle => *STDIN,
on_read => sub {
my ( $self, $buffref ) = @_;
while( $$buffref =~ s/^(.*)
?
// ) {
print "You said: $1
";
}
},
) );
$loop->add( IO::Async::Signal->new(
name => 'INT',
on_receipt => sub {
print "SIGINT, will now quit
";
$loop->loop_stop;
},
) );
$loop->loop_forever();
DESCRIPTION
This subclass of IO::Async::Loop uses IO::Epoll to perform read-ready and write-ready tests so that the O(1) high-performance multiplexing
of Linux's epoll_pwait(2) syscall can be used.
The "epoll" Linux subsystem uses a registration system similar to the higher level IO::Poll object wrapper, meaning that better performance
can be achieved in programs using a large number of filehandles. Each epoll_pwait(2) syscall only has an overhead proportional to the
number of ready filehandles, rather than the total number being watched. For more detail, see the epoll(7) manpage.
This class uses the epoll_pwait(2) system call, which atomically switches the process's signal mask, performs a wait exactly as
epoll_wait(2) would, then switches it back. This allows a process to block the signals it cares about, but switch in an empty signal mask
during the poll, allowing it to handle file IO and signals concurrently.
CONSTRUCTOR
$loop = IO::Async::Loop::Epoll->new()
This function returns a new instance of a "IO::Async::Loop::Epoll" object.
METHODS
As this is a subclass of IO::Async::Loop, all of its methods are inherited. Expect where noted below, all of the class's methods behave
identically to "IO::Async::Loop".
$count = $loop->loop_once( $timeout )
This method calls the "poll()" method on the stored "IO::Epoll" object, passing in the value of $timeout, and processes the results of that
call. It returns the total number of "IO::Async::Notifier" callbacks invoked, or "undef" if the underlying "epoll_pwait()" method returned
an error. If the "epoll_pwait()" was interrupted by a signal, then 0 is returned instead.
SEE ALSO
o IO::Epoll - Scalable IO Multiplexing for Linux 2.5.44 and higher
o IO::Async::Loop::Poll - use IO::Async with poll(2)
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>
perl v5.14.2 2012-04-10 IO::Async::Loop::Epoll(3pm)