473,406 Members | 2,954 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Simple & Stupid C++ question

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
5 1597
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
* 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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Brad Tilley | last post by:
Probably a stupid question, but here goes: Is there any way to get a scaled down version of Python onto a Linksys Wireless router? Are there any projects out there that are doing this? I've...
2
by: ian justice | last post by:
Before i post actual code, as i need a speedyish reply. Can i first ask if anyone knows off the top of their head, if there is a likely obvious cause to the following problem. For the moment i've...
40
by: Woolly Mittens | last post by:
I was asked to find some documentation which explains how to develop a website using DIV's and CSS, instead of TABLES. This is to explain to the people we outsource things to, how we want it done....
30
by: Kong Bhat | last post by:
With XML becoming the de facto data description standard, I am extremely surprised that there is no movement towards standardizing an xml library API for use with C and C++. Personally I have been...
2
by: cisco | last post by:
Could anyone point me in the direction of a document that describes the difference between JET and Access? I can't seem to find anything. Another question i have is i have this application (.net)...
16
by: | last post by:
I saw this code in C++ but when tried to C causes an error: ------------- void function(int &a) { a = 5; } ------------- with this, passed in "function" the "a" pointer instead of "a" value, BUT...
72
by: Paminu | last post by:
In math this expression: (a < b) && (b < c) would be described as: a < b < c But why is it that in C these two expressions evaluate to something different for the same values of a, b and...
5
by: Alberto Salvati | last post by:
Hi, List. My company has a VERY BIG product base on db2 udb v7.x. We want to di an upgrade to v9, but.... current db has a lot of procedure (cobol..!). Therefore, we've planned to rewrite this...
46
by: Sensei | last post by:
I was having an interesting discussion about the ANSI C and some ``weird inconsistencies'', or at least what at first sight can be seen as an imbalance. I hope someone can satisfy my curiosity. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.