|
From looking at the code you linked to, it looks like you would do the following:
std::string EncodedString;
if ( myFile.read ( buffer, 100 ) )
{
EncodedString = base64_encode( buffer, 100 );
}
|
|
|
|
|
WOW!!!
How near i was!!!
Thank you a lot!!!!
Now, a little problem, how I can get the size of the file, to get all the base64?
modified on Wednesday, December 24, 2008 12:44 PM
|
|
|
|
|
I'm not familiar with the class you're using to read the file, so I'm afraid I can't help you there. But have a good holiday!
|
|
|
|
|
Well, base 64 means that there are 64 characters in the character set. It takes 6 bits to represent the characters 0-63, so multiply the number of bytes by 8, and divide by 6 to get the converted character count (probably need to add 63 to the byte count times 8 before dividing to catch any partial character at the end).
Dave.
|
|
|
|
|
Thanks for your help, but I was meaning the size of the file, to dinamically adjust the size of the char array and the second parameter of the read command.
Happy holidays for you too
EDIT: Solved I got the size with the stat() function, now it is working flawless.
Thank a lot, CodeProject is great!!
modified on Thursday, December 25, 2008 6:04 AM
|
|
|
|
|
Possibly reading a Good C/C++ tutorial: you've to pieces of code already done. Is it so difficult to glue them a bit?
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
Did you get my mail?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
No I have not received any email, Send it Directly to admin@d-eye.es
|
|
|
|
|
Hi,
Actually i want to make an C++ application whose purpose is to do Database Operation .
And here MS Access will be my database.
So please help me out as soon as possible.
Thank you,
Shashi
|
|
|
|
|
who is stopping you from doing the application??
|
|
|
|
|
God bless U!
|
|
|
|
|
|
See Database[^].
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
In VSS 2005 project settings we have option to set
Enable C++ Exceptions: No, Yes (/EHsc), Yes With SEH Exceptions (/EHa).
By default i am not able to get any exception.(even dividebyzero).
By setting that option to /no. is working fine. please clarify.
|
|
|
|
|
/no is OK unless you have any code in your executable that uses exceptions. For example, if you use iostreams, Visual C++ will complain that you should enable exception handling code.
Using /EHs means you can only catch synchronous exceptions (== C++ exceptions, for all intents and purposes).
Using /EHa allows you to catch C++ exceptions AND structured exceptions (== the native Win32 exception mechanism).
In general, if you're just using iostreams or other bits of STL, /EHs is fine. If you're not using STL and your code has no exception handling, /no should be fine.
|
|
|
|
|
hai!
i have hexadecimal string
strHex = "0c"
i want to convert it to
strDec = "12"
strHex = "FF"
strDec = "256"
How to do it?
Thanks !
|
|
|
|
|
Try this
char* strHex = "0c";
char strDec[50];
int nValue = 0;
sscanf( strHex, "%x", &nValue );
sprintf( strDec, "%d", nValue );
|
|
|
|
|
kapardhi wrote: strHex = "FF"
strDec = "256"
You've actually to fool a bit the underlying math to obtain the above conversion
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]
|
|
|
|
|
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello Team,
I am planning to write an application in VC++ to find free calender in outlook.
in our company, all the meeting rooms are listed in outlook calender. to finding a free meeting room takes hello lot of time, i have to look for each room. so resolve this, i am planning to write
an application which will have all the possible rooms listed, and user can search for it.
to find the free cal, to intract with outlook cal, searching in calender, what are the API supported in VC++ ?
Thank you
|
|
|
|
|
In MS-outlook calenders are inside pst file, Is there only one pst file?
modified on Wednesday, December 24, 2008 1:01 AM
|
|
|
|
|
Thank you
I am not sure about this. can you pls put some lights on this
|
|
|
|
|
Hi all,
I have posted same question again, Nobody is responding me Please respond the query.
I uesd FSCTL_GET_VOLUME_BITMAP to get free cluster list but When bitmap is very large it can not be fit into buffer, So I tried to read the bitmap in small chunks of bytes but I am always getting the bitmap from startting 0 offset, How could I read bitmap in small chunks.
my code is here, Please correct if i am wrong
BOOL CFreeCluster::GetBitmap()
{
STARTING_LCN_INPUT_BUFFER StartingLCN;
VOLUME_BITMAP_BUFFER *Bitmap = NULL;
ULONGLONG BitmapSize;
DWORD BytesReturned;
BOOL Result;
StartingLCN.StartingLcn.QuadPart = 0;
BitmapSize = sizeof (VOLUME_BITMAP_BUFFER) + 4;
Bitmap = (VOLUME_BITMAP_BUFFER *) malloc (BitmapSize);
HANDLE hHandle=OpenDrive();
Result = DeviceIoControl
(
hHandle,
FSCTL_GET_VOLUME_BITMAP,
&StartingLCN,
sizeof (StartingLCN),
Bitmap,
BitmapSize,
&BytesReturned,
NULL
);
if (Result == FALSE && GetLastError () != ERROR_MORE_DATA)
{
free (Bitmap);
return (false);
}
BitmapSize = (Bitmap->BitmapSize.QuadPart / 8) + 1;
int nBufferSize=8*512*3;
ULONGLONG ullItr=BitmapSize/nBufferSize;
if(BitmapSize%nBufferSize!=0)
ullItr++;
Bitmap = (VOLUME_BITMAP_BUFFER *) realloc (Bitmap, nBufferSize+1);
ULONGLONG ullClusterNo=0;
for (ULONGLONG ullTmp=0; ullTmp < ullItr; ullTmp++)
{
if(BitmapSize < nBufferSize)
nBufferSize=BitmapSize;
memset(Bitmap->Buffer,0x0,nBufferSize+1);
StartingLCN.StartingLcn.QuadPart=ullTmp*nBufferSize;
Result = DeviceIoControl
(
hHandle,
FSCTL_GET_VOLUME_BITMAP,
&StartingLCN,
nBufferSize,
Bitmap,
nBufferSize,
&BytesReturned,
NULL
);
int p=GetLastError();
if (Result == FALSE && GetLastError () != ERROR_MORE_DATA)
{
free (Bitmap);
return (false);
}
BitmapSize=BitmapSize-nBufferSize;
}
return (true);
}
modified on Wednesday, December 24, 2008 12:18 AM
|
|
|
|
|
Is nobody able to solve my problem?
|
|
|
|
|
i am trying to open .txt text file using ShellExecute() method but it is not getting opened.
thanks in advance
|
|
|
|