-
February 21st, 2004, 02:45 AM
#1
What have i got?
Hey guys i was playing around making a C++ program! First i made a file called unix.cpp and here is the code inside it.
#include <iostream.h>
#include <string.h>
#include <stdlib.h>
void telnet()
{
cout<<"\tSLACKWARE 2005"<<"\n";
cout<<"\tThis program will only be used for good intesions or face the consequene"<<"\n"<<"\tces"<<"\n";
char inp[2334];
cout<<"\tThis is a telnet program based on UNIX";
}
void ls()
{
char in[3];
cout<<"okay let me experiment ls on dos"<<"\n";
cout<<"type in ls"<<" ";
cin.getline(in, 3, '\n');
if(in[3] == 'ls')
{
system("dir");
}
}
int main()
{
ls();
telnet();
return 0;
}
when i finished doing that. I made the final one.
#include <iostream.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
int main(int a)
{
FILE *m;
m = fopen("unix.cpp","w");
int l;
l = 300;
if(l != a)
{
cout<<m;
}
return 0;
}
I compiled and ran it and i got this 0x40d238 guys what the hell is that!!
-
February 21st, 2004, 02:52 AM
#2
I believe that is a memory location, but I'm not familiar enough with c++ to give you a true answer. I think your problem is around here
FILE *m;
m = fopen("unix.cpp","w"); //this being the problem
int l;
l = 300;
if(l != a)
{
cout<<m; //here too
}
I know at with java at least you will get that sort of number when the memory location of a string is returned.
Edit:
Looking at your code it looks like you are trying to output the source of unix.cpp? If you are trying to run the code from unix.cpp then I think you are going about it wrong by using cout<<
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|