Sponsored Content
Full Discussion: stream output??
Top Forums Programming stream output?? Post 8683 by solvman on Tuesday 16th of October 2001 01:26:16 PM
Old 10-16-2001
stream output??

Hi all,

I've a structure let's say
typdef struct a { int a; int b; char* string} b;

I need to make the function smth like readdir(), returning everytime it's called pointer to the next structure. Let's say functions would read the next file in the directory and all the permitions put it in a structure and returns it. When it's called next time it moves to the next files, etc. (It's just an example, so you would understand my task easier). How do i make that kinda STREAM output??

Thank you all,
Regards
Smilie
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Stream MP3s

What is a good and easy to set up program on Unix FreeBSD for playing streaming MP3s. Where can I get it and how do I install it? This is FreeBSD 4.3. Thanx. (2 Replies)
Discussion started by: ByondF1
2 Replies

2. Programming

File I/O Stream

Hi All, I am trying to read data from two files and then compare them and only print the records on the screen that have a same ID.i.e TAGNO =CUSTOMERNO For Eg My Input Files are (a) Transaction (b) Customer detail The data in file a is like: TagNo Date Time Station... (0 Replies)
Discussion started by: rooh
0 Replies

3. UNIX for Advanced & Expert Users

the stream edditor

:D i have searched through several sites on google for a match up for sed that would go indepth into the workings of this interactive edditor.. I use it every day and it is the edditor of my choice so i know a few tricks but would very much like to get into the more complex uses of sed.. all the... (2 Replies)
Discussion started by: moxxx68
2 Replies

4. UNIX for Dummies Questions & Answers

how can I use the stream output in other program

Hello I wander if im doing : ls -l and its giving me lets say 3 results : -rw-r--r-- 1 blah other 1789 May 19 2003 foo.c -rw-r--r-- 1 blah other 1014 May 19 2003 foo.h -rw-r--r-- 1 blah other 270 May 19 2003 foo1.c now I would like to use the first... (1 Reply)
Discussion started by: umen
1 Replies

5. UNIX for Dummies Questions & Answers

Interpreting java output stream as system commands in Solaris

Hi there again, Running Solaris 10 with built-in Java. Seems to compile and run fine. Problem is: Say I want to see contents of current directory. In a shell, I'd just write "ls" and it outputs the content. When I write a Java file, I have the following line: System.out.println("ls"); ... (1 Reply)
Discussion started by: EugeneG
1 Replies

6. Ubuntu

Stream video

Hello, I have Ubuntu 64 bit 9.04 install dual boot I can't see stream videos through Opera I couldnt see it in Firefox did this: "sudo apt-get install ubuntu-restricted-extras flashplugin-nonfree" Now I can see it in firefox but not in Opera Should not care and just use just Firefox. thanks (0 Replies)
Discussion started by: Pitroadrush
0 Replies

7. UNIX for Dummies Questions & Answers

Get the last value in the input stream

Hello Everyone, The situation is: $ alias rm="sh abc.sh" #abc.sh: read input echo "The input was: " $input $ rm xyz.txt should return "The input was: xyz.txt" Here, I want the alias "rm" to execute the file "abc.sh", where "abc.sh" should take "xyz.txt"... (1 Reply)
Discussion started by: qasim
1 Replies

8. Shell Programming and Scripting

[Video stream] network stream recording with mplayer

Hi I used this command: mplayer http://host/axis-cgi/mjpg/video.cgi -user root -passwd root \ -cache 1024 -fps 25.0 -nosound -vc ffh264 \ -demuxer 3 -dumpstream -dumpfile output.avi It's ok but... Video Playing is very fast! Why? Is it a synch problem? What parameter I have to use for... (1 Reply)
Discussion started by: takeo.kikuta
1 Replies

9. Shell Programming and Scripting

Count lines and words of a stream output with tail

Hello, I need to tail -f a file output stream and I need to get only lines that contains "get" and "point" in the same line. It doesn't matter the order. Then I need only the text BEFORE "point". I have to count each line and perform other serveral actions after this has performed 3 times.... (9 Replies)
Discussion started by: Kibou
9 Replies
DIRECTORY(3)						   BSD Library Functions Manual 					      DIRECTORY(3)

NAME
closedir, dirfd, opendir, readdir, readdir_r, rewinddir, seekdir, telldir -- directory operations LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <dirent.h> int closedir(DIR *dirp); int dirfd(DIR *dirp); DIR * opendir(const char *dirname); struct dirent * readdir(DIR *dirp); int readdir_r(DIR *restrict dirp, struct dirent *restrict entry, struct dirent **restrict result); void rewinddir(DIR *dirp); void seekdir(DIR *dirp, long loc); long telldir(DIR *dirp); DESCRIPTION
The opendir() function opens the directory named by dirname, associates a directory stream with it, and returns a pointer to be used to iden- tify the directory stream in subsequent operations. The pointer NULL is returned if dirname cannot be accessed or if it cannot malloc(3) enough memory to hold the whole thing. The readdir() function returns a pointer to the next directory entry. It returns NULL upon reaching the end of the directory or detecting an invalid seekdir() operation. readdir_r() provides the same functionality as readdir(), but the caller must provide a directory entry buffer to store the results in. If the read succeeds, result is pointed at the entry; upon reaching the end of the directory, result is set to NULL. readdir_r() returns 0 on success or an error number to indicate failure. The telldir() function returns the current location associated with the named directory stream. Values returned by telldir() are good only for the lifetime of the DIR pointer (e.g., dirp) from which they are derived. If the directory is closed and then reopened, prior values returned by telldir() will no longer be valid. The seekdir() function sets the position of the next readdir() operation on the directory stream. The new position reverts to the one asso- ciated with the directory stream when the telldir() operation was performed. The rewinddir() function resets the position of the named directory stream to the beginning of the directory. The closedir() function closes the named directory stream and frees the structure associated with the dirp pointer, returning 0 on success. On failure, -1 is returned and the global variable errno is set to indicate the error. The dirfd() function returns the integer file descriptor associated with the named directory stream, see open(2). Sample code which searches a directory for entry ``name'' is: len = strlen(name); dirp = opendir("."); while ((dp = readdir(dirp)) != NULL) if (dp->d_namlen == len && !strcmp(dp->d_name, name)) { (void)closedir(dirp); return FOUND; } (void)closedir(dirp); return NOT_FOUND; LEGACY SYNOPSIS
#include <sys/types.h> #include <dirent.h> <sys/types.h> is necessary for these functions. SEE ALSO
close(2), lseek(2), open(2), read(2), compat(5), dir(5) HISTORY
The closedir(), dirfd(), opendir(), readdir(), rewinddir(), seekdir(), and telldir() functions appeared in 4.2BSD. BSD
June 4, 1993 BSD
All times are GMT -4. The time now is 10:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy