Connecting Tech Pros Worldwide Help | Site Map

Simple & Stupid C++ question

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 22nd, 2005, 02:06 PM
Ryan Waye
Guest
 
Posts: n/a
Default 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

  #2  
Old July 22nd, 2005, 02:06 PM
Phlip
Guest
 
Posts: n/a
Default Re: Simple & Stupid C++ question

Ryan Waye wrote:
[color=blue]
> 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?[/color]

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


  #3  
Old July 22nd, 2005, 02:06 PM
Alf P. Steinbach
Guest
 
Posts: n/a
Default Re: Simple & Stupid C++ question

* Ryan Waye:[color=blue]
> I have looked extensively, and I have been unable to find commands that
> allow a C++ program to manipulate other files.[/color]

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).

[color=blue]
> How do I make C++ do simple things like copy and past files[/color]

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.

[color=blue]
> and navigate directories?[/color]

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>.

[color=blue]
> Also,
> where is a good command reference that I can use so I dont have to post
> these annoying questions?[/color]

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?
  #4  
Old July 22nd, 2005, 02:06 PM
Ryan Waye
Guest
 
Posts: n/a
Default Re: Simple & Stupid C++ question

Phlip wrote:
[color=blue]
> Ryan Waye wrote:
>
>[color=green]
>>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?[/color]
>
>
> 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".
>[/color]
I am sorry. I did not mean to get off topic, and thanks for pointing me
in the right direction.

RW
  #5  
Old July 22nd, 2005, 02:06 PM
David Harmon
Guest
 
Posts: n/a
Default Re: Simple & Stupid C++ question

On Wed, 23 Jun 2004 00:40:36 -0400 in comp.lang.c++, Ryan Waye
<rmw998@comcast.net> wrote,[color=blue]
>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?[/color]

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/

  #6  
Old July 22nd, 2005, 02:06 PM
AngleWyrm
Guest
 
Posts: n/a
Default Re: Simple & Stupid C++ question

The C++ hat random selection container:
http://home.comcast.net/~anglewyrm/hat.html
"Ryan Waye" <rmw998@comcast.net> wrote in message
news:yJCdnedCfJ9tlETdRVn-ug@comcast.com...[color=blue]
> 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?[/color]

#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


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.