Nameful
yes, why?
Anunay
😆
Ahadu
I am begginer for C++.i am not idea how can write a program any one help me?
Janko Ⓥ
Bumpy
Hello eve, I have two files (hpp,cpp)
In the hpp files I declared a overloading function and I want to implement them on the cpp file.
Bumpy
When I’m compile I get an error of all my functions : “must be a unary/binary operator”
Bumpy
Anyone know why?
hiddenpiggy
show me your code
Distac_221
#include <stdio.h>
#include <sys/socket.h>
#include <errno.h>
#include <netdb.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char **argv){
struct hostent *host;
int err, i, sock, start, end;
char hostname[100];
struct sockaddr_in sa;
printf("Enter hostname or IP:");
gets(hostname);
printf("\n");
printf("Enter start port number: ");
scanf("%d", &start);
printf("\n");
printf("Enter end port number: ");
scanf("%d", &end);
memcpy((char*)&sa, "", sizeof sa);
sa.sin_family = AF_INET;
if(isdigit(hostname[0])){
sa.sin_addr.s_addr = inet_addr(hostname);
}
else if ( (host = gethostbyname(hostname)) != 0){
memcpy((char*)&sa.sin_addr, (char*) host->h_addr, sizeof sa.sin_addr);
}
else {
herror(hostname);
exit(2);
}
for(i = start; i <= end; i++){
printf("Scanning port %i\n",i);
sa.sin_port = htons(i);
sock = socket(AF_INET, SOCK_STREAM, 0);
if(socket < 0){
exit(1);
}
err = connect(sock, (struct sockaddr*)&sa, sizeof sa);
if (err < 0){
fflush(stdout);
}
else {
printf("Port %i is open\n", i);
}
close(sock);
}
fflush(stdout);
return 0;
}
Distac_221
how can i make this to work on atmega32
Distac_221
i want to do some tcp/udp port scanning
A
hi
Anonymous
Hello everyone
Anonymous
I am fresher to c++
Anonymous
Which book is best for c ++
Anonymous
Please suggest
Gabriel
Nameful
I'm very curious why anyone would prefer autotools
Nameful
I don't have any vendetta against GNU, but I never found autotools to be very pleasant to work with
Gabriel
I think that Autotools is very hard to understand!
Lion
You can't go back and blame the old days
Anonymous
Anonymous
sorry, wrong replying[
Anonymous
klimi
i think you messed your things here, they are different things
Nameful
[Gaal wase bilaa cashuur ]?_ 2 grals
Yes
klimi
cmake is something else than make for example
klimi
and cmake cannot compile by itself like make does
Nameful
And I think Autotools is comparable to them as well
klimi
why is make there then
Nameful
Idk
Dima
wow such c++ related
Dima
but it’s QT anyways
Mark
Pls can someone help with this: What is the largest numeric value that could be represented with three
bytes if each digit were encoded using one ASCII pattern per byte? What
if binary notation were used?
Hariyana Grande
#include <stdio.h>
const int MAX = 3;
int main () {
int var[] = {10, 100, 200};
int i, *ptr;
/* let us have array address in pointer */
ptr = var; //MY QUESTION IS ABOUT THIS PART, WHY NOT ptr = &var;
for ( i = 0; i < MAX; i++) {
printf("Address of var[%d] = %x\n", i, ptr );
printf("Value of var[%d] = %d\n", i, *ptr );
/* move to the next location */
ptr++;
}
return 0;
}
Hariyana Grande
why did they skip "&" in ptr=var; ?
oogeek
oogeek
var actually points to the first element of that array
Hariyana Grande
this var is array in this programm which of int type right
Hariyana Grande
yes that i know
Hariyana Grande
but still as pointer stores the address of var
Hariyana Grande
so we need & to store the address right?
oogeek
Hariyana Grande
wait
Hariyana Grande
instead of %u they used %x i guess
Hariyana Grande
in first printf
oogeek
ptr has type int *
var also have type int *
var[1] is actually *(var+1)
So assign var to ptr is OK.
Then by ptr++ and *ptr, the number stored at each place will be passed to printf
mayway
Anyone one have any idea where i can learn c++ for free
Hariyana Grande
Anonymous
Hey could anyone help on how to encrypt file. Just a simple method not that hard
oogeek
oogeek
oogeek
Hariyana Grande
😁
Anonymous
Anonymous
....
Are you banned in Google or what?
oogeek
Anonymous
Anonymous
I already searched
Anonymous
I thought you guys could guide me.
Anonymous
I already searched
https://stackoverflow.com/questions/16219239/simple-encryption-algorithm
....
Anonymous
Ok thanks
oogeek
oogeek
But var is actually virtual address, the compiler will take care of that.
Hariyana Grande
thank you for clearing that too
Anonymous
Hello