473,804 Members | 3,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1620
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 "Accelerate d 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******** ************@co mcast.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
3834
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 googled around a bit, but didn't find much. I want to keep the router's software as it is, but I also would like to have some scripting abilities on it as well (like email the router's IP addy every x hours), etc. I have scripts that run on my...
2
690
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 reduced my form request to a simple text string entry, instead of my desired optional parameters. As i have been stuck with a single unfathomable glitch for over a year. Basically, if i enter queries such as ; "select * from table" "select * from...
40
5152
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. I dug around alistapart but couldn't find anything complete enough. I searched through the W3C, but could only find the standards, not how to apply them in the desired way. Does anyone have some handy links for me??? Replying them here might...
30
1999
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 working with libxml2 (www.gnome.org) for a while now, and I am quite comfortable with it. I believe that libxml2 is a good start, but I think a slimmer version of libxml2 should be standardized. Any thoughts?
2
1549
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) that writes to a databaase every 10 milliseconds(purely for testing). While it's writing i copy over the access file and it seems fine. Is this really safe? Is jet blocking until it can write? If does it queue up data. man it's hot in here...
16
7054
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 inside "function" I have access to "a" value not with "*a" but with "a". Why this is not working in C?
72
4251
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 c?
5
1883
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 code in sql or other language. My (stupid, i think..) question is: someone know a "thing" (wizard, tool, application..) helpful to reduce needed work to convert/transform cobol code? For example, a tool that dows a reverse enigineering of...
46
2201
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. The standard provides means to open files associating a /path/ with a /stream/. The standard does not provide any means to handle /directories/. There are three streams defined by the standard, stdin stdout stderr. Am I right? Now, what is the...
0
9705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9575
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9134
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7609
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6846
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5513
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5645
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4288
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2981
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.