Hi Steven,
SD>Hello. I am new to this area. I have worked with C++ for almost a year,
bu
SD>have done nothing serious with it (a few games). I have three question to
SD>whoever can answer them.
Your code is pure C.
SD>1. I have this program that always gives me a warning and I was wondering
if
SD>there was a way to get rid of the warning.
SD>#include
SD>main()
int main(void)
SD>{
SD>unsigned char Monster_Name;
unsigned char * Monster_Name; // Declare a pointer to a char string
_OR_
char Monster_Name[25]; // Gives some space for the string to go in.
SD>Monster_Name = "Bear";
// You attempted to put a pointer to 5 chars into a single char!
// This is OK if you declare Monster_Name as a pointer
_OR_
strcpy (Monster_Name,"Bear"); // If your declaration is Monster_Name[25]
SD>clrscr();
SD>printf("%s", Monster_Name);
SD>getch();
SD>return(0);
SD>}
SD>The warning I get is this :
SD>Warning Nonportable pointer conversion in function main
SD>Any ideas how to get rid of this? I know it doesn't hurt
SD>the program, but when
Oh it does hurt the program. You will end up over-writing something
important at some time and the results can be "interesting"...
SD>you have 20 or so of them, it gets anoying.
SD>My next question is how do you use dos commands in C++. I mean if I
anted
SD>make a program that could show all the files in a certain directory, or
make
SD>directories, etc. how would I do this?
You can do these types of things better useing the built in file
handling capabilities of the language.
SD>My last question is this. How do you save to a seperate file (name of
perso
SD>age, other information), and how do you retrieve this information in the
sam
SD>program?
Again, time to look up the file handling side of the language.
SD>Thank-you very much to those who answer my questions. I know they might
see
SD>trivial, but suggestions would be greatly appreciated! Thanks.
You may be better looking for help in the C_ECHO as from what you've
given you're codeing in C. Regrettably, due to internal Region 25
echo politics, I don't have ready access to the international version of
the echo :-(
George
* SLMR 2.1a * Desk: A very large wastebasket with drawers.
--- Maximus/2 3.01
---------------
* Origin: DoNoR/2,Woking UK (44-1483-725167) (2:440/4)
|