|
Thanks very much you guy's. Its much appreciated.
Andrew McIntyre
|
|
|
|
|
If you are using VS6, click Ctrl+] to locate matching braces (which will indirectly show you unmatched braces). I know there's a similar way in VS200x, but I don't know it off the top of my head.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
I've seen functions defined as:
int SetIniString(int nConfigSet, char *Section, char *Key, const char *format, ... );
Could someone explain what the '...' in the parameter list means and does?
|
|
|
|
|
|
Thank you David, for the explanation and link!
|
|
|
|
|
Paul Belikian wrote: Could someone explain what the '...' in the parameter list means and does?
It means that the function also accepts zero or more parameters following the last named parameter. The function will then use some information passed by the caller (in this case the %x specifications in the format string) and the va_arg[^] functions, to access the extra parameters.
|
|
|
|
|
Thank you too Richard, I appreciate your response!
|
|
|
|
|
hi all
i am developing an application in which i need to find a sector that does not allocated space by a file or folder.
|
|
|
|
|
Yeah, I know. You told us all about it over the course of the last week.
What have been your advances in this time? What suggestions have been usefull/useless? What have you found out about FAT and NTFS since then?
You do realize, don't you that FAT is a 'simple' format, and all you have to do is look at the File Allocation Table to see which sectors are used by which files. If a sector's not in the list of used sectors, guess what? It's not used.
There's enough info in the File Allocation Table page at Wikipedia to do the FAT work. 
|
|
|
|
|
enhzflep wrote: There's enough info in the File Allocation Table page at Wikipedia to do the FAT work.
That just doesn't sound right.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Oops!
|
|
|
|
|
Are you looking for an empty disk sector? On what type of file system?
Best Wishes,
-David Delaune
|
|
|
|
|
Hello all ,
As windows Vista and windows 2008 have all come with an option of "Run as Administrator", Is there some way to programmatically invoke some executable so as it could be invoked as 'Administrator' ?
Regards,
Kushagra
|
|
|
|
|
|
Randor wrote: support article:
CreateProcessAsUser() windowstations and desktops[^]
P.S.
Have you finally decided to follow my recommendations[^] for delaying the windows shutdown?
Hey Randor,
Its gr8 to hear from u again, CreateProcessAsUser is what I am looking into, but what I need is some way to elevate permissions of my executable as soon as it is invoked.
and yes I was successful in delaying shutdown by creating a service and handling SERVICE_CONTROL_SHUTDOWN . Your suggestion helped me a lot . Thanks for always showing the way.
Kushagra
|
|
|
|
|
Hi Kushagra,
I should have given a more complete answer. I assumed that you were still working on that windows service. The following MSDN article addresses elevation from a standard windows application.
Redesign for UAC Compatibility (UAC)[^]
Best Wishes,
-David Delaune
|
|
|
|
|
Thank you
I am now looking at it
|
|
|
|
|
Can I include some thing in my code to make the application run as Administrator every time when it starts ?
Or could I make any other application which when invoked starts my executable to runas Administrator ???All this I have to do in VISTA and WINDOWS 2008 as UAC always comes into picture ..
Kushagra
|
|
|
|
|
Hi,
I am trying to send a pdf file from server to client using sockets. My code is
server:
FILE *fp;
int i,j,endoffile;
char buf[1024],pathoffile[1024],msg[24];
if((send(TheClient,msg,sizeof(msg),0))!=0)
if((recv(TheClient,pathoffile,sizeof(pathoffile),0))!=0)
printf("\n\tPath is %s",pathoffile);
fp=fopen(pathoffile,"rb");
if(fp==NULL)
{
printf("\n\tFailed to open File");
system("pause");
}
for (i=0, endoffile=0 ; ; )
{
j = fread(buf, 1, sizeof(buf), fp);
if (j < 0)
{
system("pause");
}
if (j == 0)
{
endoffile = 1;
printf("\n\tFile successfully sent");
system("pause");
}
j = send(TheClient, buf, j, 0);
printf("\n\tsending buf to client.Value of send %d",j);
if (j <= 0)
{
printf("\n\tUnable to send");
system("pause");
}
}
}
client:
int i,j;
HANDLE hFile=NULL;
char buf[1024],msg[24],pathoffile[1024];
DWORD dw;
if((recv(sock,msg,sizeof(msg),0))!=0)
printf("\n\t%s",msg);
gets(pathoffile);
if((send(sock,pathoffile,sizeof(pathoffile),0))!=0)
printf("path sent sucessfully");
hFile = CreateFileA(".", GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == NULL || hFile == INVALID_HANDLE_VALUE)
{
hFile = NULL;
}
for (i=0 ; ; )
{
j=recv(sock, buf, sizeof(buf), 0);
printf("\n\treceiving file...plz wait.");
if (j <= 0)
break;
i += j;
WriteFile(hFile, buf, j, &dw, 0);
}
CloseHandle(hFile);
when i run my program .in server window it shows "sending buf to client.Value of send 0".I am unable to that where is the error happaning?
|
|
|
|
|
After the following line:
j = send(TheClient, buf, j, 0);
you should check for SOCKET_ERROR and WSAGetLastError() to see if there was a failure.
Also in your client code you have hFile = CreateFileA(".", GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL, NULL); which is wrong. You cannot create a file with the name ".".
I would suggest adding some more error checking code to both systems to try and discover what is happening.
|
|
|
|
|
Embarrassing as this code may be to me (I am a bit of a C++ noob), why don't the third console input take? It acts like I held down the enter key after entering my height in inches.
This sample is part of an exercise from a book.
#include <iostream>
using namespace std;
const unsigned char inchesInFoot = 12;
const float metersInInch = 0.0254;
const float poundsInKilogram = 2.2;
int main()
{
unsigned char userFeet, userInches;
unsigned short userPounds;
float userMeters;
float userKilograms;
cout << "Enter your height in feet:";
cin >> userFeet;
cout << "Now enter the remaining inches of your height:";
cin >> userInches;
cout << "How many pounds do you weight?:";
cin >> userPounds;
userInches = userFeet * inchesInFoot + userInches;
userMeters = userInches * metersInInch;
userKilograms = userPounds / poundsInKilogram;
cout << "Your BMI is " << userKilograms / (userMeters * userMeters) << endl;
return 0;
}
|
|
|
|
|
I don't see anything wrong with it, and it works for me.
Squirrelly keyboard, maybe?
|
|
|
|
|
LunaticFringe wrote: I don't see anything wrong with it, and it works for me.
Its only when I enter 11 in the inches part that it skips the weight cin .
|
|
|
|
|
You have problems in the data types. char is not appropriate here. Everything will work fine if you change that.
Best wishes,
Navaneeth
|
|
|
|
|
N a v a n e e t h wrote: You have problems in the data types. char is not appropriate here. Everything will work fine if you change that.
Yes, that fixed it. I wish there were a simple unsigned byte primitive that would work in this context.
|
|
|
|
|