|
Well, presumably the obj files will take the same name as the cpp files - differing only in the extension.
Also, being lowly .obj files, they won't necessarily exist in the installed version of the program (nor am I able see a reason at this time to choose to include them)
Sooo, I'd just use the _FILE_ macro and do a string replace on the extension, changing it from .cpp to .obj
Here's about the cheapest, nastiest example I can think of right now. I'll leave it to you to figure out how to change the folder names...
#include <iostream>
using namespace std;
int main()
{
char *buffer;
char *insertPos;
cout << "Source File name: " << __FILE__ << endl;
buffer = new char[strlen(__FILE__)+1];
strcpy(buffer, __FILE__);
insertPos = strstr(buffer, ".cpp");
strcpy(insertPos, ".obj");
cout << "OBJ File name: " << buffer << endl;
delete buffer;
return 0;
}
|
|
|
|
|
its just a convertor to .obj file from .cpp, while taking current cpp file.
My requirement is some how I can check how many no Of OBJ files(only .obj files corresponds to .cpp files which are included in project not every kernel or OS related file)
e.g I have two files (abc.cpp and xyz.cpp) these corresponds to (abc.obj and xyz.obj) only these 2 obj's i need to get at runtime that's it.
In other words at RUNTIME I can give the exe file name , and it should give me all .obj files OR source files which are participating in that project. that's it.
AGAIN NO ANY .OBJ FILE NEEDED THOSE ARE OF KERNEL OR OS related file or IO related which I did'nt defined in my project EXPLICITELY.
|
|
|
|
|
|
Just a suggestion. If the .OBJ files contains debug information, there maybe some API's to use in order to obtain what .CPP file the object came from. A runtime debugger will need to know this, but I have no idea of how it is accomplished.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
|
|
|
|
|
hi,
i have localized my application and converted it to unicode.when i set code page in control panel to english everything shows in japanese except msflexgrid headers.can any one tell me how to resolve the issue?
|
|
|
|
|
Hi,
Can anyone give an example of CListCtrl::SortGroups.I want to sort the groups alphabetically.
Thanks.
|
|
|
|
|
Check the code associated with this article.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi,
I have a small programm which listen a socket in a new thread. but I want to restart the porgramm after the first message.
Start the thread in main.cpp
<code>hThread = CreateThread(
NULL,
0,
ThreadFunc,
&dwThrdParam,
0,
&dwThreadId); </code>
The programm :
<code>DWORD WINAPI ThreadFunc( LPVOID lpParam )
{
WSAStartup(MAKEWORD(2,2),&initialisation_win32);
socket_recevoir=socket(AF_INET,SOCK_DGRAM,0);
information_recevoir.sin_family=AF_INET;
information_recevoir.sin_addr.s_addr=INADDR_ANY;
information_recevoir.sin_port=htons(25);
bind(socket_recevoir,(struct sockaddr*)&information_recevoir,sizeof(information_recevoir));
tempo=sizeof(information_recevoir);
nb_caracters=recvfrom(socket_recevoir,buffer,1515,0,(struct sockaddr*)&information_recevoir,&tempo);
buffer[nb_caracters]=0;
if (nb_caracters >0)
{
ExecuteCommand(buffer, NULL, 0);
}
closesocket(socket_recevoir);
return 0;
} </code>
In main.cpp, I want to call again this programm.
Can you help me please ?
modified on Monday, April 5, 2010 10:42 AM
|
|
|
|
|
Hi, from what I can see the socket is not doing anything or you did not post the full code. The server socket never calls listen or accept . Maybe you could provide us more information? In a nutshell there a three possible designs for a server: your server handles one client at a time (example), uses asynchronous I/O (multiple connections in a single thread context) or uses multi threading (one connection per thread).
Here are some links that might come helpful:
- Internet / Network - CodeProject[^]
- Beej's guide to networking programming[^]
- Winsock Programmer's FAQ[^]
Last two have working client/server examples in section 6. Hope it helps
/M
Webchat in Europe Now with 26% more Twitter
modified on Monday, April 5, 2010 5:40 AM
|
|
|
|
|
this application execute this line : ExecuteCommand(buffer, NULL, 0) but only one time.
I will check your links
|
|
|
|
|
Could you please format your code with <pre> tag for readability and remove the French comments? It was quite hard to read.
Looking again at your code, you have a blocking UDP socket waiting for a connection, which calls ExecuteCommand() and exists the thread? Perhaps all you are looking for is a for loop (and a way to programatically exit the worker thread)?
/M
Webchat in Europe Now with 26% more Twitter
modified on Monday, April 5, 2010 9:10 AM
|
|
|
|
|
Think you for your help. I removed the comments and used
. I hope it's easier to read.
yes, you're right, I want to add a loop but I don't where in my code.
Think you
|
|
|
|
|
Okay thanks for the formatting!
Let my try to help.... put the loop around the blocking part (pseudocode):
socket();
bind();
for(;;)
{
recvfrom();
if(ok) ExecuteCommand();
}
closesocket();
Right now the worker thread has no exit condition, you probably want to add one in order to avoid terminating the thread the hard way at application exit. Also have a look at some other issues, e.g. starting from this line
nb_caracters=recvfrom(socket_recevoir,buffer,1515,0,(struct sockaddr*)&information_recevoir,&tempo);
should become something like
int nb_caracters = recvfrom(socket_recevoir, buffer, sizeof(buffer)-1, 0, (struct sockaddr*)&information_recevoir, &tempo);
if(nb_caracters > 0)
{
buffer[nb_caracters] = 0;
ExecuteCommand(buffer, NULL, 0);
}
Webchat in Europe Now with 26% more Twitter
modified on Monday, April 5, 2010 3:34 PM
|
|
|
|
|
is it possible to give different colors for each row in Listview..
ie blue for the contents in first row
red for 2nd
and so on
thanks in advance.
|
|
|
|
|
As far as i know you can only do that by using an owner-drawn list control and drawing the rows yourself or you can use some pre-made "extended" list control, like CListCtrlEx[^].
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
|
I all
I got one example from planetsourcecode.When i compile these code then i am geeting error please help me.
#include "stdafx.h"
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#include<string.h>
int _tmain(int argc, _TCHAR* argv[])
{
char *s;
int i,l,*a,f,c,x;
printf("Enter a string : ");
scanf("%s",s);
l=strlen(s);
s[l]=0;
a=(char*)malloc(l);
for(i=0;i<l[i++]=0);
f=1,c=0;
while(f)
{
x=l-1;
a[x]=c++;
for(i=0;i<l&& c-1<l;i++)
printf("%c",s[a[x]]);
if(i>=l)
printf("\n");
while(a[x]>=l)
{
a[x]=c=0;
if(x<0){f=0;break;}
a[x]++;
}
}
printf("Completed");
return 0;
}
Error
error C2440: '=' : cannot convert from 'char *' to 'int *'
error C2109: subscript requires array or pointer type
error C2143: syntax error : missing ';' before ')'
Please help me
|
|
|
|
|
You can seee the error...
Now decide why?
int i,l,*a,f,c,x;
printf("Enter a string : ");
scanf("%s",s);
l=strlen(s);
s[l]=0;
<big>a=(char*)malloc(l);</big>
Величие не Бога может быть недооценена.
|
|
|
|
|
yes i know there is error.When i change Int *a to CHAR *a.But still i have two error.
Error
error C2109: subscript requires array or pointer type
error C2143: syntax error : missing ';' before ')'
If you know solution or condition then please help me
|
|
|
|
|
I cannot get the this code?
Surely having problem, but whether it is related to your code or formating error, please check these things, you can solve these issues.
These are just syntax errors.
for(i=0;i f=1,c=0;
Величие не Бога может быть недооценена.
|
|
|
|
|
Thanks for reply
I have change in code then runing well.Please check it.
#include "stdafx.h"
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#include<string.h>
int _tmain(int argc, _TCHAR* argv[])
{
char *s,*a;
int i,l,f,c,x;
printf("Enter a string : ");
scanf("%s",s);
l=strlen(s);
s[l]=0;
a=(char*)malloc(l);
for(i=0;i<l;i++);
f=1,c=0;
while(f)
{
x=l-1;
a[x]=c++;
for(i=0;i<l && c-1<l;i++)
printf("%c",s[a[x]]);
if(i>=l)
printf("\n");
while(a[x]>=l)
{
a[x]=c=0;
if(x<0){f=0;break;}
a[x]++;
}
}
printf("Completed");
return 0;
}
Error
Run-Time Check Failure #3 - The variable 's' is being used without being initialized.
Please help me
|
|
|
|
|
Here, i think you have to help yourself, by learning the syntax of C.
I prefer you to read a C programming book to get throught with syntax.
See in your code, you cannot use scanf as you wish, it is expecting the address of s. so your compiler is complaining
scanf("%s",s);
Expected code is
scanf("%s",&s);
Величие не Бога может быть недооценена.
|
|
|
|
|
Thanks for reply
Now i am getting exception in line s[l]=0;
Unhandled exception at 0x1026f8bc (msvcr90d.dll) in TestingProject.exe: 0xC0000005: Access violation reading location 0xcc006975.
|
|
|
|
|
try this
char *s = new char;
Failure is Success If we learn from it!!
|
|
|
|
|
I have change in code char *s = new char(230)
Still i have same exception.
Please help me
|
|
|
|
|