473,405 Members | 2,334 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,405 software developers and data experts.

I can't move from c: to D: or any other drive

Hi GUYS!
i am facing a problem in this program chechk it.

#include<iostream.h>
#include <stdlib.h>
void main()
{
system("D:");
system("dir");

}
the problem i face over here is that it can't move to d drive it shows
the files in c:
mean dir in c:
So how can i use it ?

Oct 25 '07 #1
5 1238
On 2007-10-25 12:23, Xohaib wrote:
Hi GUYS!
i am facing a problem in this program chechk it.

#include<iostream.h>
#include <stdlib.h>
void main()
{
system("D:");
system("dir");

}
the problem i face over here is that it can't move to d drive it shows
the files in c:
mean dir in c:
Kind of off-topic since it involves how the command interpreter in
Windows works, for future questions of this nature please ask in a group
discussing Windows or Windows programming.

The reason the above does not work is that each call to system starts a
new instance of the command interpreter and what you did in the first
does not affect the second. What you want to do is to run several
command in one system() call, you can do this by using && (and probably
in some other way).

system("D: && dir");

--
Erik Wikström
Oct 25 '07 #2
=?UTF-8?B?RXJpayBXaWtzdHLDtm0=?= <Er***********@telia.comwrote in
news:ER*****************@newsb.telia.net:
The reason the above does not work is that each call to system starts a
new instance of the command interpreter and what you did in the first
does not affect the second. What you want to do is to run several
command in one system() call, you can do this by using && (and probably
in some other way).

system("D: && dir");
Perhaps the better question is, why use system() at all? The operations
presented are better effected by filesystem library calls. Some of these
are standardized and portable while others are very OS-dependent. Best to
collect what you want to do into a utility class that isolates OS
dependencies.

Such libraries are already readily available from various sources, such as
Boost, wxWidgets, and Qt.
Oct 25 '07 #3
On Oct 25, 5:26 pm, Kenneth Porter <shiva.blackl...@sewingwitch.com>
wrote:
=?UTF-8?B?RXJpayBXaWtzdHLDtm0=?= <Erik-wikst...@telia.comwrote innews:ER*****************@newsb.telia.net:
The reason the above does not work is that each call to system starts a
new instance of the command interpreter and what you did in the first
does not affect the second. What you want to do is to run several
command in one system() call, you can do this by using && (and probably
in some other way).
system("D: && dir");

Perhaps the better question is, why use system() at all? The operations
presented are better effected by filesystem library calls. Some of these
are standardized and portable while others are very OS-dependent. Best to
collect what you want to do into a utility class that isolates OS
dependencies.

Such libraries are already readily available from various sources, such as
Boost, wxWidgets, and Qt.
If want to delete some files from d: or other directory like D:
\Example then what should i do ???

Oct 31 '07 #4
Xohaib wrote:
[..]
If want to delete some files from d: or other directory like D:
\Example then what should i do ???
If you know the names of the files you want to delete, use 'remove'
function. If you need to delete all of them, use 'system' with the
appropriate command to do it for you. If you can't find the proper
command, you need to look through the available tools (API) for the
platform you're using. Your compiler probably has some (at least
rudimentary) support for programming your OS. RTFM.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Oct 31 '07 #5
Xohaib <zo************@gmail.comwrote in news:1193831172.177427.202220
@z9g2000hsf.googlegroups.com:
If want to delete some files from d: or other directory like D:
\Example then what should i do ???
Google is your friend.

http://www.opengroup.org/onlinepubs/...ns/remove.html
Nov 2 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: MarcinS | last post by:
hello, my problem is how to move data files drom drive c: to drive d: ?? -- MarcinS
1
by: Douglara | last post by:
I have a system configured with Windows 2000 and SQL Server 2000 Clustering (active/passive). Both SQL Servers have a local E:\ drive with the same directory structure. I would like to move the...
2
by: Jim Richards | last post by:
I have been told by a local PC club technician that 98SE cannot read NTFS drives in a network. Is this true? TIA, Jim.
6
by: Neo The One | last post by:
On my development machine, I often delete all folders/files under C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files. That has not caused me any trouble til now. So now we have...
3
by: Krazy Katt | last post by:
-- I am trying to install the MSDN version of Visual Studio Professional 2005 and the goddamn install won't let me change the installation drive -- it shows that everything will be installed to...
8
by: Mark D Powell | last post by:
I obviously did not search the archives on the right terms so what is the easiest and fastest way to move a 3G database from a nearly full C drive to the nearly empty D drive that should have been...
5
atljpe
by: atljpe | last post by:
In Excel: My query can only be refreshed if your using z: as your drive header. I want to change it so anyone can refresh this query wether they're using x, y, or z for their drive header: The...
2
by: sandromani | last post by:
Hello, I have a IIS 6.0 webserver (windows 2003 EE) and, working on an asp project, noticed that oddly the server refuses to move a folder from one drive to another. Take the following code: <%...
8
by: inFocus | last post by:
Hello, I am new to python and wanted to write something for myself where after inputing two words it would search entire drive and when finding both names in files name would either copy or move...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
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
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.