944,155 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 13037
  • C++ RSS
Jan 1st, 2005
0

Visual c++ libraries

Expand Post »
Hi, just wanna ask if c++ opendir,readdir and closedir code can be implemented in visual c++, i have resently started using this complier and dunno what libraries have changed and if some of these sentences are still valid, and if u can recommend me some kind of "migrating c++ to visual c++" tutorial ill really apreciate it
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
diegomoreno is offline Offline
3 posts
since Dec 2004
Jan 1st, 2005
0

Re: Visual c++ libraries

i would assume if it is MSC++ to MSVC++ then the libraries would be the same? if not there is a brilliant fstream tutorial in the c/c++ tutorials forum that - from the names of the functions - sounds like it could be used to do the same thing; and of course fstream is part of the ANSI standard (ie all compilers support it)
Reputation Points: 16
Solved Threads: 6
Posting Pro in Training
1o0oBhP is offline Offline
445 posts
since Dec 2004
Jan 2nd, 2005
0

Re: Visual c++ libraries

>just wanna ask if c++ opendir,readdir and closedir code can be implemented in visual c++
They're not supported by the library, but you can write versions of them if you really want to using FindFirstFile and FindNextFile.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Jan 2nd, 2005
0

Re: Visual c++ libraries

Quote originally posted by Narue ...
>just wanna ask if c++ opendir,readdir and closedir code can be implemented in visual c++
They're not supported by the library, but you can write versions of them if you really want to using FindFirstFile and FindNextFile.
thx for the tip, but vc++ has similar functions to browse directories\ get files attributes like readdir/findfirst/next? if u can post the names of that kind of functions it will really help me a lot; or maybe a sample code that implement those.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
diegomoreno is offline Offline
3 posts
since Dec 2004
Jan 3rd, 2005
0

Re: Visual c++ libraries

>if u can post the names of that kind of functions
Are you blind? I gave you the two functions that you need to do what you want to do, whether it's faking POSIX functions, or solving your problem with the straight Windows functions. Now go to MSDN and do the research on them. And in case you missed it the first two times:

FindFirstFile and FindNextFile

Geez.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Jan 3rd, 2005
0

Re: Visual c++ libraries

I know this is very old code from the attic and dusted off a little. It might give you a hint or confuse you totally.
[php]
// read the filenames from a given directory

// globals
#define MAXFILES 1500 // maximum filenames in buffer
char fbuf[MAXFILES][80]; // filename buffer
int fbntotal; // total number of filenames in buffer

struct {
char reserved[21];
char attribute;
int time;
int date;
long size;
char name[13];
} dirdata; // structure for directory info

...

// read the files in the directory specified in path
// needs full pathname consisting of drive, path and dirname
// reads filenames into a global buffer
void fs_readdir(char *path)
{
int k, done;

done = findfirst(path,&dirdata,0);
for (k = 0; !done; k++)
{
sprintf(fbuf[k],"%s",dirdata.name);
done = findnext(&dirdata);
if (k >= MAXFILES)
break;
}
fbntotal = k; // total entries in filename buffer
}
[/php]
Moderator
Reputation Points: 1333
Solved Threads: 1404
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Desiging a set of rules for a match
Next Thread in C++ Forum Timeline: newbie needs help, basic mfc stuff





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC