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.
7 Replies - 969 Views - Last Post: 23 June 2012 - 04:48 AM
Replies To: Dos commands stopped working under visual studio.
#2
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.
Thanks.
#3
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
#4
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.
#5
Re: Dos commands stopped working under visual studio.
Posted 26 July 2008 - 05:31 AM
maugly, 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).
#6
Re: Dos commands stopped working under visual studio.
Posted 26 July 2008 - 08:56 AM
baavgai, on 26 Jul, 2008 - 05:31 AM, said:
maugly, 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.
#7
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
++++++
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
++++++
maugly, 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.
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.
#8
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.
This topic is 4 years old. It's probably sorted by now.
Closed.
Page 1 of 1
|
|

New Topic/Question
This topic is locked




MultiQuote






|