By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,206 Members | 1,020 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,206 IT Pros & Developers. It's quick & easy.

Simple & Stupid C++ question

P: n/a
I have looked extensively, and I have been unable to find commands that
allow a C++ program to manipulate other files. How do I make C++ do
simple things like copy and past files, and navigate directories? Also,
where is a good command reference that I can use so I dont have to post
these annoying questions?

RW
Jul 22 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Ryan Waye wrote:
I have looked extensively, and I have been unable to find commands that
allow a C++ program to manipulate other files. How do I make C++ do
simple things like copy and past files, and navigate directories? Also,
where is a good command reference that I can use so I dont have to post
these annoying questions?


Use http://groups.google.com to find the group that supports your compiler.

This newsgroup is only qualified to discuss raw C++, which can run on things
without file or folders.

Your platform will come with libraries that handle these details, but
anything you write will be relatively bound to your platform. Research
"POSIX".

--
Phlip
http://industrialxp.org/community/bi...UserInterfaces
Jul 22 '05 #2

P: n/a
* Ryan Waye:
I have looked extensively, and I have been unable to find commands that
allow a C++ program to manipulate other files.
The standard C++ library has many type-safe classes that do that; have
you looked at e.g. std::ofstream?

The standard C library has many somewhat more unsafe functions and
structures. Have you looked at e.g. std::fprintf?

The C routines are generally way more efficient (but less safe) than the
C++ classes. And for even greater efficiency and less safety you can
use platform-specific functionality. Or de-facto portable, the old Unix
'read' and 'write' functions (they appear in different header files
depending on the compiler, and some compilers may not support them).

How do I make C++ do simple things like copy and past files
Assuming you mean copy and paste as in a GUI, that is not simple, and
it's platform-specific.

If you really need what you seem to be saying (probably not, but
anyway), then you need to use platform-specific functionality.

Consider that many platforms C++ is used on do not have GUI's.

and navigate directories?
The standard (C plus C++) library does not help you out there. However,
it's not quite in platform-dependent land. For example, take a look at
<url: http://www.boost.org/libs/filesystem/doc/index.htm>.

Also,
where is a good command reference that I can use so I dont have to post
these annoying questions?


Read the FAQ (go google).

Get yourself "The C++ Programming Language" plus "Accelerated C++".

Get yourself a copy of the C++ standard and/or the CD2.

Get yourself documentation for your specific platform(s) and
compiler(s).

And so on... ;-)

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #3

P: n/a
Phlip wrote:
Ryan Waye wrote:

I have looked extensively, and I have been unable to find commands that
allow a C++ program to manipulate other files. How do I make C++ do
simple things like copy and past files, and navigate directories? Also,
where is a good command reference that I can use so I dont have to post
these annoying questions?

Use http://groups.google.com to find the group that supports your compiler.

This newsgroup is only qualified to discuss raw C++, which can run on things
without file or folders.

Your platform will come with libraries that handle these details, but
anything you write will be relatively bound to your platform. Research
"POSIX".

I am sorry. I did not mean to get off topic, and thanks for pointing me
in the right direction.

RW
Jul 22 '05 #4

P: n/a
On Wed, 23 Jun 2004 00:40:36 -0400 in comp.lang.c++, Ryan Waye
<rm****@comcast.net> wrote,
I have looked extensively, and I have been unable to find commands that
allow a C++ program to manipulate other files. How do I make C++ do
simple things like copy and past files, and navigate directories?


Opening files, reading the contents into variables, and writing out new
files are all reasonably straightforward using standard stream classes.

This issue is covered in Marshall Cline's C++ FAQ. See section "[15]
Input/output via <iostream> and <cstdio>". It is always good to check
the FAQ before posting. You can get the FAQ at:
http://www.parashift.com/c++-faq-lite/

Jul 22 '05 #5

P: n/a
The C++ hat random selection container:
http://home.comcast.net/~anglewyrm/hat.html
"Ryan Waye" <rm****@comcast.net> wrote in message
news:yJ********************@comcast.com...
I have looked extensively, and I have been unable to find commands that
allow a C++ program to manipulate other files. How do I make C++ do
simple things like copy and past files, and navigate directories? Also,
where is a good command reference that I can use so I dont have to post
these annoying questions?


#include <cstdlib> // system

int main() {
system("echo Hi.");
system("dir /b /w");
system("pause");
system("C:");
system("CD c:\\");
system("dir /p");
system("pause");
}
--
AngleWyrm
Jul 22 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.