well, i guess they dont need to global, now that i think about i, i just need to pass them as references... and the NM nm(); was my mistake, it was just an example. I guess i shoulda put a bit more...
Type: Posts; User: c++.prog.newbie
well, i guess they dont need to global, now that i think about i, i just need to pass them as references... and the NM nm(); was my mistake, it was just an example. I guess i shoulda put a bit more...
im not sure how to word this but how do i do this
class NM //create class
...
NM nm(); //call default constructor
yes, thank you. i just realized what i was trying to do, wouldnt work how i thought it would.
thank you again salem.
EDIT: i seem to be having some problems with the mem* and str* functions... i have the following code:
int size = strlen(message) + sizeof(int);
char *buffer = new...
ok im having a few issues with this. I pack the message length and the message into the buffer and send it, the size of the message is 14. but when it gets to the other side and i read in the size...
ok,
thanks for the help.
oh, i think i get it now.
so on the recieving end it would be something like...
int messagesize;
char* buffer;
read(socket, messagesize, sizeof(int),0);
read(socket, buffer,...
could you explain what you mean by that.
the problem is im using UDP (its for a game) so there is no guarantee that the size will arive before the message.
EDIT: woops, i thought i posted it, but when i came here to look it wasnt there...
if i have a packet like so...
struct PACKET
{
unsigned char message;
unsigned short length;
char* message;
}
if i have a packet like so
struct PACKET
{
unsigned char command;
unsigned short length;
char* message;
};
it contains multiple files,
all of which get compiled,
and yes its a new project in a new directory,
its a new vc++ project not an old one,
yes i have tried rebuild all, and it shows all of...
ok, i reinstalled MSVC++ express 2005 and it doesnt complain about not finding main, but it cant read a .lib that i need it to. where as MSVC++ 6.0 and Dev-C++ can. I also know that it is opening...
im using it cause Dev was getting a little to weak for what i need, and MSVC++ express 2005 didnt want to work for me... i tried multiple times... but i think i will have to try again :(
EDIT: and...
ok, this program that i'm making worked just fine while using Dev-C++, and GCC, but when i moved it to MSVC++ 6.0 it says it cant find _main.
Here is a more detailed error message:
Linking......
i wanted to do it so that a class can access a vector located in the main program, without having to pass it as a parameter for every function call.
how would i make a pointer to a vector?
thx
i dont know about the wifi part but here is about the socket programming
http://beej.us/guide/bgnet/output/html/index.html
:P i just realized i dont need to proto type the static function anywere :D...
but that only solves one problem... the main one is still left
Server.o(.text+0x2144): In function...
just read in until you get a newline character
file.getline(array,maxsizeofarray,'\n');
if say i have a function
static int test()
in another file would i proto type it
extern static int test()
extern int test()
or
static int test()
?
:D ok i got that problem figured out, im still getting the error
sendto: Invalid argument
which is printed out using perror("sendto")...
i tried entering the following code for debugging...
ok i got two files, one has functions in it the other uses them, pretty simple right :D
in one file i have this
static void xtoa(unsigned long val, char *buf, unsigned int radix, int...
actually i got a different problem,
how do i get the address from a hostent* (h->h_addr) into a myaddr.sin_addr.s_addr ?
when i use sento (UDP) in my program trying to send a mesg from one computer to the same one i get this error
sendto: Can't assign requested address
i tried 127.0.0.1 and the actual IP address...