Unix Programming - What is the *nix equivalent of win32 io.h ?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > April 2005 > What is the *nix equivalent of win32 io.h ?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author What is the *nix equivalent of win32 io.h ?
Groleo

2005-04-12, 7:49 am

Hi.

I'm trying to port a piece of code, written for win32, that
uses finddata_t structure, along with the findfirst/findnext functions.
Is there an equivalent , or a work-around, that implements finddata_t
on
*nix platform?

Joe Estock

2005-04-12, 6:02 pm

Groleo wrote:
> Hi.
>
> I'm trying to port a piece of code, written for win32, that
> uses finddata_t structure, along with the findfirst/findnext functions.
> Is there an equivalent , or a work-around, that implements finddata_t
> on
> *nix platform?
>

If you would explain what you are trying to do and show us some code it
would make it easier for us to help point you in the right direction.

Joe Estock
Norman Black

2005-04-12, 6:02 pm

"Groleo" <groleo@gmail.com> wrote in message
news:1113298726.856014.53570@g14g2000cwa.googlegroups.com...
> Hi.
>
> I'm trying to port a piece of code, written for win32, that
> uses finddata_t structure, along with the findfirst/findnext functions.
> Is there an equivalent , or a work-around, that implements finddata_t
> on
> *nix platform?
>


Try looking at the following functions

opendir
readdir, readdir_r
fnmatch

Norman


Måns Rullgård

2005-04-12, 6:02 pm

"Norman Black" <nospam@nospam.com> writes:

> "Groleo" <groleo@gmail.com> wrote in message
> news:1113298726.856014.53570@g14g2000cwa.googlegroups.com...
>
> Try looking at the following functions
>
> opendir
> readdir, readdir_r
> fnmatch


scandir, where available.

--
Måns Rullgård
mru@inprovide.com
Groleo

2005-04-12, 6:02 pm

Sure.
(Sorry for the late posting.)
Here is the code:

struct _finddata_t t;


138 do
139 {
140 if(gi_NumFiles == 1000) Fatal("Too many input files", 0);
141 strcpy(gazstar + gazstarin, t.name);
142 gpst_Files[gi_NumFiles++].psz_FileName = gazstar +
gazstarin;
143 gazstarin += strlen(t.name) + 1;
144 } while(_findnext(h, &t) != -1);

Chuck Dillon

2005-04-13, 5:59 pm

Groleo wrote:
> Sure.
> (Sorry for the late posting.)
> Here is the code:
>
> struct _finddata_t t;
>
>
> 138 do
> 139 {
> 140 if(gi_NumFiles == 1000) Fatal("Too many input files", 0);
> 141 strcpy(gazstar + gazstarin, t.name);
> 142 gpst_Files[gi_NumFiles++].psz_FileName = gazstar +
> gazstarin;
> 143 gazstarin += strlen(t.name) + 1;
> 144 } while(_findnext(h, &t) != -1);
>


I think you missed the point. You are asking in a UNIX group. It's
somewhat rude to just name an API from another system (e.g. win32) and
expect the readers to be able to translate that into what functionality
they provide. Describe the functionality you are looking for.

Having said that, take a look at glob(3c) and ftw/nftw.

-- ced

--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.
Måns Rullgård

2005-04-13, 6:00 pm

Chuck Dillon <spam@nimblegen.com> writes:

> Groleo wrote:
>
> I think you missed the point. You are asking in a UNIX group. It's
> somewhat rude to just name an API from another system (e.g. win32) and
> expect the readers to be able to translate that into what
> functionality they provide. Describe the functionality you are
> looking for.
>
> Having said that, take a look at glob(3c) and ftw/nftw.


fnmatch might come in handy, too.

--
Måns Rullgård
mru@inprovide.com
Casper H.S. Dik

2005-04-13, 6:00 pm

=?iso-8859-1?q?M=E5ns_Rullg=E5rd?= <mru@inprovide.com> writes:

>Chuck Dillon <spam@nimblegen.com> writes:


[vbcol=seagreen]
>fnmatch might come in handy, too.



Or perhaps nothing at all because the shell does the globbing for
him.

Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
Groleo

2005-04-13, 6:00 pm

Hi again.
The readdir_r did the magic.

Sory to Dillon, for asking in this group.
I have a question Dillon. Say that I would've asked this question
on a win32 group. What a win32 programmer would've said?
IMHO, I wouldn't get any answers.

Måns Rullgård

2005-04-13, 6:00 pm

"Groleo" <groleo@gmail.com> writes:

> Hi again.
> The readdir_r did the magic.
>
> Sory to Dillon, for asking in this group.
> I have a question Dillon. Say that I would've asked this question
> on a win32 group. What a win32 programmer would've said?


You asked in the right group, but you asked the wrong question. You
should have asked something like "How can I read the names of all
files in a directory?".

--
Måns Rullgård
mru@inprovide.com
Chuck Dillon

2005-04-14, 6:03 pm

Gr oleo wrote:
> Hi again.
> The readdir_r did the magic.
>
> Sory to Dillon, for asking in this group.
> I have a question Dillon. Say that I would've asked this question
> on a win32 group. What a win32 programmer would've said?
> IMHO, I wouldn't get any answers.
>


By posting in win32 terms to c.u.p you only enable those who have
knowledge of both the win32 and *NIX APIs to respond. You assume that
there is someone here who can bridge the knowledge gap for you. So why
do you assume nobody in a win32 group could do the same? I agree that
there are likley many more c.u.p folks with win32 knowledge than the
other way round. And I agree that your question should have been asked
here.

My primary point is/was that you didn't have to just name win32 APIs
where they don't apply. You could have described the functionality you
needed and thereby communicated effectively to everyone in c.u.p rather
than just those who also have win32 API knowledged.

-- ced

--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.
Sean Burke

2005-04-14, 6:03 pm


Chuck Dillon <spam@nimblegen.com> writes:

> Gr oleo wrote:
>
> By posting in win32 terms to c.u.p you only enable those who have
> knowledge of both the win32 and *NIX APIs to respond.


That doesn't seem to have prevented you from responding.
-SEan
Chuck Dillon

2005-04-14, 6:03 pm

Sean Burke wrote:
> Chuck Dillon <spam@nimblegen.com> writes:
>
>
>
>
> That doesn't seem to have prevented you from responding.
> -SEan


And your point is what?

-- ced

--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.
Sean Burke

2005-04-14, 6:03 pm


Chuck Dillon <spam@nimblegen.com> writes:

> Sean Burke wrote:
>
> And your point is what?


That you are being rude for no good reason.

-SEan
David Schwartz

2005-04-14, 8:48 pm


"Sean Burke" <foobar@mystery.org> wrote in message
news:x7fyxtavsy.fsf@bolo.xenadyne.com...

[vbcol=seagreen]
[vbcol=seagreen]
[vbcol=seagreen]
> That you are being rude for no good reason.


1) He wasn't rude.

2) There is a very good reason, to make sure he (and anyone else who
reads the thread) knows how to write an effective question.

DS


Groleo

2005-04-15, 5:57 pm

Hi again.

True. I haven't asked in the right manner, and I apologise.
I thanks to those who helped me, disregarding the usual "background
noise" in a thread :-P.


"Over and out...Back to work now'..."

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com