|
Member 3653751 wrote: printf("%s\n%s",pChar);
When your format string has two %s specifiers, you must have two parameters after the format string.
So add one parameter to printf() or remove one %s from format string.
modified on Tuesday, May 4, 2010 11:35 AM
|
|
|
|
|
nothing here shows you are "trimming" the string; and there's an extra "%s" in the format part of printf.
Watched code never compiles.
|
|
|
|
|
Member 3653751 wrote: unsigned char pChar[100] = "i like vc++! ";
printf("%s\n%s",pChar);
Member 3653751 wrote: it will compile and run..but it displaying 100 characters...
Because Visual C++ doesn't like you.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi.
This litte program copys the string char by char and skips the spaces.
#include <iostream.h>
int count=0,count2=0;
int strLength=0;
int main()
{
unsigned char Cstr[100] = "this is a program";
unsigned char Cstr2[100] = "";
while(Cstr[count] != '\0')
{
if((int)Cstr[count] !=32)
{
Cstr2[count2 ] = Cstr[count];
count2++;
}
count++;
strLength++;
}
for(count=0;count<strLength;count++) cout<<Cstr2[count]<<"";
cout<<"\n\n\n";
return 0;
}
|
|
|
|
|
Member 3653751 wrote: i want remove spaces from Cstr;
So what trouble(s) are you having in doing so?
"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
|
|
|
|
|
unsigned char Cstr[100] = "this is a program";
unsigned char CstrS[100];
for (int i = 0, i2 = 0; i < 100; i++)
{
if (Cstr[i] != ' ')
{
CstrS[i2] = Cstr[i];
i2++;
}
else
continue;
}
|
|
|
|
|
Hi All,
I need some help if is it possible to browse through the Hidden Drives.
I mean Hidden Drives are nothing but drive with out having a drive letter.
For example:
[ Steps to create hidden drive: MyComputer>Manage>DiskManagement>SelectDrive>ChangeDriveLetter>Click Remove Button ]
For now I am able to find the Hidden drives using some combination of following APIs:
FindFirstVolumeW
QueryDosDeviceW
GetVolumePathNamesForVolumeNameW
GetVolumeInformation
FindNextVolumeW
I need to Create Browser for the Hidden Drives. Please give some hints to proceed.
Thanks a lot in advance.
Regards
Its Me Hara
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
You have all the answers.
What problem are you facing here?
|
|
|
|
|
I was not able to get the volumes with respect to a disk.
If PC has two Hard disks, each has multiple volumes. First disk has one hidden volume, second disk has two or some hidden volumes. I need to get the total Disks, and In that particular disk the total volumes along with hidden. Any clue in this way. I got the solution as total volumes. but not with respect to disk and its volumes.. Thanks for your reply.
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
Not sure if this will help you but here is something you can try.
Try to open a volume using CreateFile by specifying the file name as \\.\C: for the C drive and dwCreationDisposition parameter as OPEN_EXISTING .
If CreateFile fails, it could mean no such volume exists or you do not have permission to do this.
Then you can use DeviceIoControl on the returned handle by specifying IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS as the control code.
You will get the information as a VOLUME_DISK_EXTENTS structure in the lpOutBuffer output parameter.
Remember that a disk can contain multiple volumes and a single volume can span multiple disks.
You will all this information using the above function.
|
|
|
|
|
The actual straight problem here I am facing is for "C:" drive i can give path as C:\bla\bla..... But For hidden drives i was not able to give any specific base drive path. That is main problem, Is there any way to solve it. thanks a lot for your reply.
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
Let's assume D: is the hidden drive.
In this case is it not possible to specify the volume name as \\.\D: ?
|
|
|
|
|
Hidden drive will not have the drive letter. If we go to the DiskManager application, and -> rightclick on one drive -> change or remove drive letter -> Click remove drive letter button. Drive letter will be removed. Also the drive will be disappered from my computer.
But When we want the drive back as normal drive then we have to go to the same place same way. and you can see your drive again in my computer. add drive letter. all the data of the drive will be available as it is. Any way i will try in my ways, if i got solution i will share with you guys. Thanks.
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
So you mean to say that when the drive is hidden CreateFile fails?
|
|
|
|
|
"CreateFile & DeviceIoControl", combination is the only way i am thinking, but there must be some specific set of arguments I need to pass to call them to make it work. I dont know about that. I am first time using that creatfile function and such driver level calls etc and also there are less number of examples in net.
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
Try this assuming D: is the hidden drive.
HANDLE hVol = ::CreateFile(_T("\\.\D:"), GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
|
|
|
|
|
Hidden drive will not have drive letter, that is the problem.
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
You mean, you don't see it.
But did you try it with CreateFile ?
|
|
|
|
|
Hi all,
I am trying to delete registry entries. my problem is i have deleted a particular value in a given sub key, but if any other value is present in that sub key then that sub key should not get deleted otherwise it should delete the sub key also..
I am not getting how to find out that there is a value in a subkey or that sub key is empty.
Is there some api present for doing so...
Thanks in advance
|
|
|
|
|
Yes, use the RegEnumValue()[^] function, to get all the value entries in a key or sub key.
It's time for a new signature.
|
|
|
|
|
And ignore the 'default' value
|
|
|
|
|
That's why I always try to post sensible links in my answers; so people will learn where the documentation is and actually try to use it properly to help them learn.
It's time for a new signature.
|
|
|
|
|
Hi,
I need to automate three applications that run on a single server, and I was planning to use Powershell with the Windows automation snapin. All my powershell scripts that can do the automated input/keyboard strokes are ready. However I need to be able to detect when an application requests focus.
So I have three apps running all maximized, only one has focus at a time. When one of the apps is done doing some calculations and expects input it requests focus. If it's not the current app that has focus, it starts flashing in the taskbar (so the window does not come to the front automatically). It's this flashing that I need to detect, so that it triggers my powershell script to bring the app to the front, so that it can do the input of data in the window.
I was thinking this could be a simple commandline app, e.g.:
detectappfocus.exe "Notepad"
Which would detect all focus requests from all the windows that have 'notepad' in the titlebar.
If a window requests focus it could then simply output the full title bar name to the command line. Assuming notepad with test.txt open requests focus, followed a bit later by another notepad with test2.txt open:
detectappfocus.exe "Notepad"
test.txt - Notepad
test2.txt - Notepad
I'm not sure this is a hard thing to do? Or is there a standard method to do this?
Thank you for your feedback!
Best regards,
Jan
|
|
|
|
|
how to read an Excel files(.xls) with cell values using vc++...??
|
|
|
|
|
If you have excel installed on your system, read this[^]
If you don't have Excel installed, you should find some library which will do that for you (You could do it yourself, and I could even explain how, but that will take us too far).
Oh,and next time you post, try to be less polite and more descriptive in your title...
|
|
|
|