|
hi,
if you guys could tell me how do i get the project path or the handle tht hold it . it would be gr8.
thanks for the help
Chintan
|
|
|
|
|
Are you looking to get the path of you exe? If so, use getmodulefilename().
suhredayan There is no spoon.
|
|
|
|
|
I cannot create a working connection. I need help. Here is my source:
#include <winsock.h>
#include <string>
#include <sstream>
#include <iostream>
using namespace std;
string itos(int x){
ostringstream sStream;
sStream<<x<<flush;
return(sstream.str());
}
int="" main(int="" argc,="" char="" *argv[]){
="" fills="" array="" with="" ips
="" string="" iparray[255];
="" subnetarray[1]="192.168.1" ;
="" int="" rangestart,rangeend;
="" rangestart="5;
" rangeend="5;
" index="0;
" for(int="" x="rangeStart;x<=rangeEnd;x++){
" iparray[index]="subnetArray[0]+".";
" tmp="itos(x);
" iparray[index]+="tmp;
" index++;
="" }
="" wsa="" startup
="" wsadata="" wsadata;
="" if(wsastartup(makeword(1,1),&wsadata)!="0){
" cout<<"wsastartup="" failed!\n";
="" system("pause");
="" return="" exit_success;
=""
="" socketdescriptor;
="" socketdescriptor="socket(AF_INET,SOCK_STREAM,0);
" if(socketdescriptor<0){
="" cout<<"socket="" creation="" serverport="20100;
" struct="" hostent="" *hostinfo;
="" sockaddr_in="" serveraddress;
="" ip[20];
="" strcpy(&ip[0],iparray[index].c_str());
="" cout<<ip;
="" hostinfo="gethostbyname(IP);
" serveraddress.sin_family="hostInfo-">h_addrtype;
memcpy((char *)&serverAddress.sin_addr.s_addr,hostInfo->h_addr_list[0],hostInfo->h_length);
serverAddress.sin_port=htons(serverPort);
//cout<<endl<<endl<<serveraddress.sin_addr.s_addr;
if(connect(socketdescriptor,(struct="" sockaddr*)&serveraddress,sizeof(struct="" sockaddr))="=-1){
" cout<<"="" not="" connected"<<endl;
="" }
="" else{
=""
="" system("pause");
="" return="" exit_success;
}
and="" the="" other:
#include="" <winsock.h="">
#include <iostream>
using namespace std;
int main(int argc, char *argv[]){
//wsa startup
WSADATA wsaData;
if(WSAStartup(MAKEWORD(1,1),&wsaData)!=0){
cout<<"WSAStartup failed!\n";
system("PAUSE");
return EXIT_SUCCESS;
}
int socketDescriptor;
socketDescriptor=socket(AF_INET,SOCK_STREAM,0);
if(socketDescriptor<0){
cout<<"Socket creation failed!\n";
system("PAUSE");
return EXIT_SUCCESS;
}
struct sockaddr_in myAddr;
myAddr.sin_family=AF_INET;
int serverPort=420100;
myAddr.sin_port=htons(serverPort);
char myIP[16];
gethostname(myIP,16);
myAddr.sin_addr.s_addr=inet_addr(myIP);
cout<<myip<<endl;
="" struct="" hostent="" *h;
="" h="gethostbyname(myIP);
" cout<<"hostname:="" "<<h-="">h_name<<endl;
cout<<"ip:="" "<<inet_ntoa(*((struct="" in_addr*)h-="">h_addr))<
|
|
|
|
|
Well, I haven't actually tried to validate your code yet, but it looks like you are trying to listen on port 420100 on the server app (which is out of the range of acceptable ports, it's over 65535), and the client is trying to connect to port 20100. You need to connect to the port that's being listened on. I'm assuming it's just a typeo in your code that you put 420100 instead of 20100 on the server side.
-- Rocky Dean Pulley
|
|
|
|
|
He, he. What a dumb mistake by me. But I still get the same problem. I cannot get the two to connect, even now that I am listening and connecting using the same port. Oh, I used Dev-C++ for compiling if you wanted to give it a go.
|
|
|
|
|
i need a way that i can search the harddrive for a paticular file type
|
|
|
|
|
use findfirstfile() and findnextfile() to search for a file. But this requires drive letters.
To get the drive letters at the runtime use GetLogicalDriveStrings/ GetLogicalDrives.
suhredayan There is no spoon.
|
|
|
|
|
I am using some code that is generated by a compiler generator (ANTLR[^]) and the generated code has a number of places wher it uses #line. I notice that I can comment this out and it still compiles/builds/runs. Why would anyone want to use #line ?
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
For macros and inline includes, it is real handy. By using #Line, you can reference the line of the include file, rather than the source file that the macro has been inserted into.
onwards and upwards...
|
|
|
|
|
#line tells the compiler/preprocessor that the next line in the source file should be treated as though it came from another file/line. In the case of antlr (and lex and yacc and other compiler compilers) they use #line wherever they copy code from your source file into the output file, in the case of the rule actions. This is so if there is an error in your code, the compiler will indicate where in your source file the error was, rather than the line in the generated file, which probably means nothing to you.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Is there a way to debug another process, that the process I'm debugging has done a CreateProcess() call for. I can't figure out how to load the project for the other process into the workspace for the project that I'm debugging. I'm using version 6 of Visual Studio. Thanks.
Chris Meech
I am Canadian. [heard in a local bar]
Gently arching his fishing rod back he moves the tip forward in a gentle arch releasing the line.... kersplunk [Doug Goulden]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
|
|
|
|
|
|
Thanks Chris.
Chris Meech
I am Canadian. [heard in a local bar]
Gently arching his fishing rod back he moves the tip forward in a gentle arch releasing the line.... kersplunk [Doug Goulden]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
|
|
|
|
|
A lot of people know class CHtmlView. I had found pretty functions
FIndText() and FindText2(), written by Marc Richarme (http://www.codeproject.com/miscctrl/CHtmlView_Search/CHtmlView_Search_demo.zip),
that allow to find text on loaded(!) web-page.
Now I'm making project. One of main its functions is finding text on several(!) pages.
I do not know any other way to do it excepting using function FindText2() ( or FindText() ).
Actually, it is possible to find text in several web-pages, using, for example, FindText2() for every page separately.
But this function can't be applied until web-document isn't loaded.
So, I decided to organize cycle. Each page will be loaded in every other cycle.
I mean something like this (in abstraction):
<br />
<br />
for (int i=0; i<number_of_pages; i++)<br />
{<br />
...<br />
this->Navigate2( _urls[i], NULL, NULL );
....<br />
...<br />
}<br />
<br />
My problem is concluded in follow: the FindText2() function in my code called every time before new web-page will be loaded
completely. That's why FindText2() works with old page-url, finding text on it
Having poor English level, I repeat: FindText2() forestalls loading page.
So, I would like to know have can I define when my page is loaded, and then I'll call for FindText2().
Thanks in advance, I tried to explaine my problem very exactly.
|
|
|
|
|
|
I'v just tried. But have no success.
I decided to search for text using direct reading from file. Maybe you know, is there any class to organize searching in *.txt file for concrete text?
Thank you for answering
|
|
|
|
|
I have a constants.h file that I would like to use to store constants and such.
When I include the file in a class in my project I keep getting Link Error:2005: "already defined in" errors when I try to declare a string constant in the constant.h file.
How do I create global string constants that I can use througout my app?
// constants.h: defines constants to be used througout application.
//
//////////////////////////////////////////////////////////////////////
#if !defined(APP_CONSTANTS_0209051212)
#define APP_CONSTANTS_0209051212
//no problems here
const APP_PATH_STRING_LENGTH = 255;
//link errors when using these
char* app_data_path = "data\\";
char* app_charts_path = "c:\\CHARTS\\";
#endif // !defined(APP_CONSTANTS_0209051212)
Kevin Shaffer
kshaff03@msn.com
|
|
|
|
|
I made the strings static, which appears to have solved my problem. Is this the best way to handled such a problem?
char* app_data_path = "data\\";
char* app_charts_path = "c:\\CHARTS\\";
to:
static char* app_data_path = "data\\";
static char* app_charts_path = "c:\\CHARTS\\";
Kevin Shaffer
kshaff03@msn.com
|
|
|
|
|
kshaff03 wrote:
Is this the best way to handled such a problem?
nope.
the best way is like this:
foo.cpp:
#include "foo.h"
const char* app_data_path = "data\\";
const char* app_charts_path = "c:\\CHARTS\\";
foo.h
extern const char* app_data_path;
extern const char* app_charts_path;
making them static just means that every .CPP will get its own private copy of the strings.
Image Toolkits | Image Processing | Cleek
|
|
|
|
|
Thanks Chris,
As usual, your the best.
-Kevin
Kevin Shaffer
kshaff03@msn.com
|
|
|
|
|
I am using Microsoft Visual C++ 6.0 and i need to execute a program (Ctrl+F5) passing it same arguments (as command line arguments), where can i put the arguments ?
Thanks.
|
|
|
|
|
You can pass any command line arguments to your program in the projects settings, under the Debug tab, in the Program arguments edit box.
I Dream of Absolute Zero
|
|
|
|
|
It will use the same arguments that you setup in the project settings.
Project->Settings->Debug
Program arguments field
NOTE: This is the same path for both release and debug builds
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
|
How to program proxy chains software?
Love is the law, love under will.
|
|
|
|