7 Replies - 969 Views - Last Post: 23 June 2012 - 04:48 AM Rate Topic: -----

#1 maugly  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 34
  • Joined: 20-June 08

Dos commands stopped working under visual studio.

Posted 26 July 2008 - 01:22 AM

Hi all!

In my program I use syntax like "system("cls")" and other dos commands, somehow the compiler just ignores those lines since this morning what can be the problem?
I use Visual Studio 2008 on windows xp machine.

Thanx.
Is This A Good Question/Topic? 0
  • +

Replies To: Dos commands stopped working under visual studio.

#2 Delta_Echo  Icon User is offline

  • D.I.C Addict

Reputation: 5
  • View blog
  • Posts: 722
  • Joined: 24-October 07

Re: Dos commands stopped working under visual studio.

Posted 26 July 2008 - 03:22 AM

Please give us an example of the code. Else, we cannot identify the issue.
Thanks.
Was This Post Helpful? 0
  • +
  • -

#3 maugly  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 34
  • Joined: 20-June 08

Re: Dos commands stopped working under visual studio.

Posted 26 July 2008 - 04:35 AM

#ifndef _FUNC_H
#define _FUNC_H
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
//#include "info.h"
#include "client.h"
#include "books.h"
void welcome();
void adminbooksone();
void adminmuzone();
int adminlogin();
void admintrackseek();
void adminone();
void addtrack()
{
	music Muz;
	int t,e=0;
	int w,v=0;
	char a=222, b=223;
	char ch;
	system("cls");
	printf("Enter the catalog number of the track:");
	scanf("%ld",&Muz.makat);
	printf("Enter the name of the track:");
	scanf("%s",Muz.songname);
	printf("Enter the track's publish year:");
	scanf("%d",&Muz.year);
	printf("How many Authors wrote this track(1-3)?:");
	fflush(stdin);
	scanf("%d",&v);
	printf("Enter the first author:");
	scanf("%s",Muz.names.name1);
	if (v==2) 
	{
		printf("Enter the second author:");
		scanf("%s",Muz.names.name2);
	}
	if (v==3)
	{
		printf("Enter the second author:");
		scanf("%s",Muz.names.name2);
		printf("Enter the third author:");
		scanf("%s",Muz.names.name3);
	}
	printf("Enter the price for customers:");
	fflush(stdin);
	scanf("%f",&Muz.price.clientcost);
	printf("Enter the buying price:");
	scanf("%f",&Muz.price.buycost);
	printf("Should this track be available for download to the customers?(YES/NO):");
	scanf("%s",Muz.availability);
	for (t=0;t<3;t++)
	puts("");
	printf(" The information you've entered: Item number:%ld\n\r",Muz.makat);
	for (t=0;t<55;t++)
		printf("%c",B)/>;
	puts("");
	printf("Track name: %s\n\r",Muz.songname);
	printf("Publish year: %d\n\r",Muz.year);
	printf("Entered %d Authors:\n\r",v);
	printf("    %s\n\r",Muz.names.name1);
	if (v==2) 
		printf("    %s\n\r",Muz.names.name2);
	if (v==3)
	{	
		printf("    %s\n\r",Muz.names.name2);
		printf("    %s\n\r",Muz.names.name3);
	}
	printf("The price for customers: %.2f\n\r",Muz.price.clientcost);
	printf("The price for the company: %.2f\n\r",Muz.price.buycost);
	printf("Available for download:%s\n\r",Muz.availability);
	puts("");
	printf("Is this information correct? \n<Y> to save, <N> to start over:");
	fflush(stdin);
	ch='1';
	w=1;
	puts("");
	while (w)   
	{
		ch=getch();
		puts("");
		if ((ch=='n') || (ch=='N')) {
			addtrack();
			w=0;
		}
		else 
		if ( (ch=='Y') || (ch=='y') )
		{
			w=0;
			//follow++;
			muzptr=(music*) realloc (muzptr, ((follow)*sizeof(music)));  
			if(muzptr==NULL)			
				{
					perror("Can not allocate memory!");
					exit(1);
				}
			muzptr[follow].makat=Muz.makat;
			strcpy(muzptr[follow].songname,Muz.songname);
			muzptr[follow].year=&Muz.year;
			strcpy(muzptr[follow].names.name1,Muz.names.name1);
			strcpy(muzptr[follow].names.name2,Muz.names.name2);
			strcpy(muzptr[follow].names.name3,Muz.names.name3);
			muzptr[follow].price.clientcost=Muz.price.clientcost;
			muzptr[follow].price.buycost=Muz.price.buycost;
			strcpy(muzptr[follow].availability,Muz.availability);
			muzptr[follow+1].makat=0;
			printf("The new data succesfully entered the database!");
			follow++;
		}
		else 
		printf("Invalid choice! Try again:");
	}	
	system("pause");
	adminmuzone();
}

int adminlogin() 
{
	char pass[20]={"12345"};
	char pass1[20];
	int a=0;
	puts("");
	printf("Please enter the aministration password:");
	scanf("%s",pass1);
	if (!(strcmp(pass,pass1))) adminone();
		else {printf("You are not alowed here!\n\r");
			system("pause");
			welcome();
	}
	return(a);
}

void welcome()
{
	char a=0;
	system("cls");
	system("color f");
//	printf("Welcome to the MUSIC AND BOOKS SHOP!\n\r\n\r");
	printf("Press '1' to enter as Shop Administrator.\n\r");
	printf("Press '2' to enter as Client.\r\n\r");
	printf("ESC to exit:");
	a=getch();
	if ((!(a=='1')) && (!(a=='2')) && (!(a==(0x1b)))) 
	{
		puts("");
		puts("Incorrect choice.");
		system("pause");
		welcome();
	}
	if (a=='1')  adminlogin();
	if (a=='2') clientlogin();
}

void adminone()
{
	char a;
	system("cls");
	system("color e");
	puts("");
	printf("     Welcome to administration Zone!\n\r\n\r");
	puts("     MAIN MENU");
	puts("     ---------");
	puts("1. Enter the books area");
	puts("2. Enter the Music area");
	puts("3. Logout");
	puts("4. ESC to exit");
	puts("");
	printf("Your choice please(1-4), other key to exit:");
	a=getch();
	puts("");
	if ((!(a=='1')) && (!(a=='2')) && (!(a=='3')) && (!(a==(0x1b)))) 
	{
		puts("");
		puts("Incorrect choice.");
		system("pause");
		adminone();
	}
	if (a=='1') adminbooksone();
	if (a=='2') adminmuzone();
	if (a=='3') welcome();
}

void adminmuzone()
{
	char a;
	system("cls");
	puts("");
	puts("      MUSIC MENU");
	puts("      ----------");
	puts("1. Add a Track");
	puts("2. Search for a track (for details/update/delete)");
	puts("3. Back to main menu");
	puts("ESC to exit.");
	puts("");
	printf("Your choice please(1-3), other key to exit:");
	a=getch();
	puts("");
	if ((!(a=='1')) && (!(a=='2')) && (!(a=='3')) && (!(a==(0x1b)))) 
	{
		puts("");
		puts("Incorrect choice.");
		system("pause");
		welcome();
	}
	if (a=='1') addtrack();
	if (a=='2')	admintrackseek();
	if (a=='3') adminone();

}
void admintrackseek()
{
	char a;
	int i=0;
	system("cls");
	printf("Track Search\n");
	printf("------------\n");
	puts("");
	printf("1. Show all the tracks");
	
	a=getch();
	if (a=='1') 
	{
		while (!(&muzptr[i].makat))
		{
			
			printf("%u",&muzptr[i].makat);
			i++;
			system("pause");
		}
	}}
#endif



Was This Post Helpful? 0
  • +
  • -

#4 Delta_Echo  Icon User is offline

  • D.I.C Addict

Reputation: 5
  • View blog
  • Posts: 722
  • Joined: 24-October 07

Re: Dos commands stopped working under visual studio.

Posted 26 July 2008 - 04:57 AM

Sorry :( I can't read C. Thought this was a C++ topic.
Was This Post Helpful? 0
  • +
  • -

#5 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 4884
  • View blog
  • Posts: 11,279
  • Joined: 16-October 07

Re: Dos commands stopped working under visual studio.

Posted 26 July 2008 - 05:31 AM

View Postmaugly, on 26 Jul, 2008 - 04:22 AM, said:

In my program I use syntax like "system("cls")" and other dos commands.


I'm afraid my initial response would be, why? Particularly since you're just controlling screen stuff.

For system("pause"), getchar() should work for you. For why such things are bad, this is a pretty good writeup.


system("cls") can normally be left out. However, since you've included the non portable conio.h you should have access to a clrscr() function if you really want it. Also, that lib as functions for pause, if you don't like the standard solution.

For system("color f") and system("color e") ... wtf? Again, with the conio thing, you may have access to functions like textcolor(YELLOW).
Was This Post Helpful? 0
  • +
  • -

#6 maugly  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 34
  • Joined: 20-June 08

Re: Dos commands stopped working under visual studio.

Posted 26 July 2008 - 08:56 AM

View Postbaavgai, on 26 Jul, 2008 - 05:31 AM, said:

View Postmaugly, on 26 Jul, 2008 - 04:22 AM, said:

In my program I use syntax like "system("cls")" and other dos commands.


I'm afraid my initial response would be, why? Particularly since you're just controlling screen stuff.

For system("pause"), getchar() should work for you. For why such things are bad, this is a pretty good writeup.


system("cls") can normally be left out. However, since you've included the non portable conio.h you should have access to a clrscr() function if you really want it. Also, that lib as functions for pause, if you don't like the standard solution.

For system("color f") and system("color e") ... wtf? Again, with the conio thing, you may have access to functions like textcolor(YELLOW).


Thanks alot!!!
you really saved my day.
Was This Post Helpful? 0
  • +
  • -

#7 vc_sasc  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 23-June 12

Re: Dos commands stopped working under visual studio.

Posted 23 June 2012 - 04:27 AM

Dear Maugly,

Good news.The DOS command is working in Visual Studio 2010 express edition. Hope it will work on other VS 2010 editions as well. For long time, i am waiting for this.. Ah!
Thanks for for your question.

Cheers!!
Chandra
++++++


View Postmaugly, on 26 July 2008 - 01:22 AM, said:

Hi all!

In my program I use syntax like "system("cls")" and other dos commands, somehow the compiler just ignores those lines since this morning what can be the problem?
I use Visual Studio 2008 on windows xp machine.

thanks.

Was This Post Helpful? 0
  • +
  • -

#8 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 5669
  • View blog
  • Posts: 22,516
  • Joined: 23-August 08

Re: Dos commands stopped working under visual studio.

Posted 23 June 2012 - 04:48 AM

Dear vc_sasc,

This topic is 4 years old. It's probably sorted by now.

Closed.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1