L-Value Error

View: New views
2 Messages — Rating Filter:   Alert me  

L-Value Error

by Wilayat :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi

I want to read an string and then convert it to a BYTE Pointer.
Before it was like below:

Code:
BYTE* pbMessage;
pbMessage = (BYTE*)TEXT("Hello");

it worked and no problems. Now i want to enter a short message during
run time. so i changed to the following:


Code:
char MsgToBeSigned[20];
BYTE* pbMessage;

printf(" \n Enter a short Message...");
scanf_s("%c", MsgToBeSigned);

pbMessage = (BYTE*)TEXT(MsgToBeSigned);

it gives the error: error C2065: 'LMsgToBeSigned' : undeclared
identifier

If i changed the statement
Code:
 pbMessage = (BYTE*)TEXT(MsgToBeSigned);to

Code:
pbMessage = (BYTE*)(MsgToBeSigned);then it gives the error: error
C2065: 'MsgToBeSigned' : undeclared identifier

Can anybody help me? I need few line of code which can get a short
message at run time, and then store it in a BYTE pointer.

regards,
wilayat

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users" Google Group.
To unsubscribe, send an email to cryptopp-users-unsubscribe@....
More information about Crypto++ and this group is available at http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---


Re: L-Value Error

by ka-bar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


codes:
#include <stdio.h>

typedef unsigned char BYTE;

int main()
{
        char MsgToBeSigned[20];
        BYTE* pbMessage;

        printf(" \n Enter a short Message...");
        scanf("%s", MsgToBeSigned);

        pbMessage = (BYTE*)(MsgToBeSigned);
        printf("%s\n",(char*)pbMessage);
        getchar();
        getchar();
        return 0;
}

I've already test it in vc8 with no problem.

goodluck,
ka-bar

On 7月29日, 上午3时02分, Wilayat <wilay...@...> wrote:

> Hi
>
> I want to read an string and then convert it to a BYTE Pointer.
> Before it was like below:
>
> Code:
> BYTE* pbMessage;
> pbMessage = (BYTE*)TEXT("Hello");
>
> it worked and no problems. Now i want to enter a short message during
> run time. so i changed to the following:
>
> Code:
> char MsgToBeSigned[20];
> BYTE* pbMessage;
>
> printf(" \n Enter a short Message...");
> scanf_s("%c", MsgToBeSigned);
>
> pbMessage = (BYTE*)TEXT(MsgToBeSigned);
>
> it gives the error: error C2065: 'LMsgToBeSigned' : undeclared
> identifier
>
> If i changed the statement
> Code:
>  pbMessage = (BYTE*)TEXT(MsgToBeSigned);to
>
> Code:
> pbMessage = (BYTE*)(MsgToBeSigned);then it gives the error: error
> C2065: 'MsgToBeSigned' : undeclared identifier
>
> Can anybody help me? I need few line of code which can get a short
> message at run time, and then store it in a BYTE pointer.
>
> regards,
> wilayat
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users" Google Group.
To unsubscribe, send an email to cryptopp-users-unsubscribe@....
More information about Crypto++ and this group is available at http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---

LightInTheBox - Buy quality products at wholesale price!