Click here to Skip to main content
15,912,021 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to delete specific elements in a char pointer Pin
toxcct10-Oct-07 23:22
toxcct10-Oct-07 23:22 
GeneralRe: how to delete specific elements in a char pointer Pin
chandu00411-Oct-07 4:04
chandu00411-Oct-07 4:04 
GeneralRe: how to delete specific elements in a char pointer Pin
Priya_Sundar10-Oct-07 23:45
Priya_Sundar10-Oct-07 23:45 
GeneralRe: how to delete specific elements in a char pointer Pin
jhwurmbach11-Oct-07 0:46
jhwurmbach11-Oct-07 0:46 
GeneralRe: how to delete specific elements in a char pointer Pin
Priya_Sundar11-Oct-07 1:35
Priya_Sundar11-Oct-07 1:35 
GeneralRe: how to delete specific elements in a char pointer Pin
jhwurmbach11-Oct-07 1:50
jhwurmbach11-Oct-07 1:50 
GeneralRe: how to delete specific elements in a char pointer Pin
Priya_Sundar11-Oct-07 2:41
Priya_Sundar11-Oct-07 2:41 
GeneralRe: how to delete specific elements in a char pointer Pin
jhwurmbach11-Oct-07 3:31
jhwurmbach11-Oct-07 3:31 
Priya_Sundar wrote:
Now this function is always returning false as UuidFromString is always returning RPC_S_INVALID_STRING_UUID telling that the string UUID/GUID 'GuidString' is invalid.


Wow.
This is the first time you give a proper error report.
You never mentioned this function before.

OK. For me
#include "stdafx.h"

#include <atlstr.h>
#include <iostream>
#include <RPC.h>

#pragma comment( lib, "Rpcrt4")

int _tmain(int argc, _TCHAR* argv[])
{
  const char szValue[] = "{A89377EA-D4ED-4A03-A37F-4A9DE785E1A9}";//This is some parameter

  // Here, anything after the first up to the last but one character gets assigned to the CString
  CString szGuidString( szValue+1, strlen(szValue)-2);
  GUID ret = { 0 };
  const RPC_STATUS status = UuidFromString( (unsigned char*)(LPCTSTR)szGuidString, &ret);
  if( status == RPC_S_OK)
  {
    ...
  }
  else
  {
    ...
  }

  return system("pause");
}
worked.
Note the double cast in the UuidFromString-call: It is used to get the raw const TCHAR* from the CString, and the other cast tells the compiler "Shut up and take this as if it were unsigneds!".
That is not Unicode-compatible. Under Unicode, the CString would hold wchar_ts, and by forcing the compiler to tread them as a string of unsigned chars, anything could happen.


Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal.
George Orwell, "Keep the Aspidistra Flying", Opening words

GeneralRe: how to delete specific elements in a char pointer Pin
Priya_Sundar11-Oct-07 1:42
Priya_Sundar11-Oct-07 1:42 
GeneralRe: how to delete specific elements in a char pointer Pin
toxcct11-Oct-07 1:48
toxcct11-Oct-07 1:48 
GeneralRe: how to delete specific elements in a char pointer Pin
jhwurmbach11-Oct-07 1:58
jhwurmbach11-Oct-07 1:58 
QuestionRe: how to delete specific elements in a char pointer Pin
David Crow11-Oct-07 3:45
David Crow11-Oct-07 3:45 
GeneralRe: how to delete specific elements in a char pointer [modified] Pin
chandu00411-Oct-07 4:01
chandu00411-Oct-07 4:01 
GeneralRe: how to delete specific elements in a char pointer Pin
chandu00411-Oct-07 4:05
chandu00411-Oct-07 4:05 
GeneralRe: how to delete specific elements in a char pointer Pin
Matthew Faithfull10-Oct-07 23:23
Matthew Faithfull10-Oct-07 23:23 
AnswerRe: how to delete specific elements in a char pointer Pin
toxcct10-Oct-07 23:33
toxcct10-Oct-07 23:33 
GeneralRe: how to delete specific elements in a char pointer Pin
Priya_Sundar10-Oct-07 23:48
Priya_Sundar10-Oct-07 23:48 
GeneralRe: how to delete specific elements in a char pointer Pin
jhwurmbach11-Oct-07 0:48
jhwurmbach11-Oct-07 0:48 
AnswerRe: how to delete specific elements in a char pointer [modified] Pin
Nelek11-Oct-07 0:15
protectorNelek11-Oct-07 0:15 
QuestionHow to use InvokeHelper function in C++? Pin
PhanMinhDuy10-Oct-07 22:37
PhanMinhDuy10-Oct-07 22:37 
Question[SOLVED]type specifier for UINT64 Pin
chandu00410-Oct-07 22:36
chandu00410-Oct-07 22:36 
AnswerRe: type specifier for UINT64 Pin
Nelek10-Oct-07 22:51
protectorNelek10-Oct-07 22:51 
AnswerRe: type specifier for UINT64 Pin
Nibu babu thomas10-Oct-07 22:52
Nibu babu thomas10-Oct-07 22:52 
General[SOLVED] thanks Pin
chandu00410-Oct-07 22:59
chandu00410-Oct-07 22:59 
Questionhdc to Bitmap Pin
GauranG Shah10-Oct-07 22:11
GauranG Shah10-Oct-07 22:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.