Click here to Skip to main content
15,903,012 members
Home / Discussions / Mobile
   

Mobile

 
AnswerRe: how to convert from CTime to CString HELP Pin
João Paulo Figueira2-Apr-04 4:54
professionalJoão Paulo Figueira2-Apr-04 4:54 
GeneralHelp !!! Problem in calling webservice from PocketPC Pin
Anonymous31-Mar-04 23:21
Anonymous31-Mar-04 23:21 
QuestionQuick Question... Internet? Pin
Anonymous31-Mar-04 12:56
Anonymous31-Mar-04 12:56 
Questionhow to go from CString to char [] Pin
rodneyk131-Mar-04 10:27
rodneyk131-Mar-04 10:27 
AnswerRe: how to go from CString to char [] Pin
Daniel Strigl31-Mar-04 19:43
Daniel Strigl31-Mar-04 19:43 
GeneralRe: how to go from CString to char [] Pin
rodneyk12-Apr-04 4:31
rodneyk12-Apr-04 4:31 
GeneralRe: how to go from CString to char [] Pin
Daniel Strigl2-Apr-04 19:03
Daniel Strigl2-Apr-04 19:03 
Generalprinting to a text file...HELP PLEASE Pin
rodneyk131-Mar-04 8:51
rodneyk131-Mar-04 8:51 
I have created an MFC app and I am using the code that you have on the web to read and write. the first problem is

1. I think from a combo box you can only read the info as a CString (is that right?)and then I pass it to the readFile method and when I do all the casting to try to get it to write the string it only prints the first letter. Can you si what I am doing wrong?

do you have suggestions?

//Get current selections from edit and list-box controls
CString szChoice;
CString szResult;
int nChoice;
m_name.GetWindowText( szChoice);
nChoice = m_name.GetCurSel();
//if(nChoice!=CB_ERR)
{
//if a valid choice was made from the list box, fetch
//the item's text string.
m_name.GetLBText(nChoice,szChoice);
szResult="Closing after selecting "+ szChoice;
fileRead(L"\\My Documents\\my_file.txt",szChoice);
}

void fileRead(TCHAR *szFileName, CString szChoice)
{

hFile = CreateFile(szFileName, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
//if (hFile != INVALID_HANDLE_VALUE)
{
// Note that we are writing a string, not a unicode string

LPTSTR p = szChoice.GetBuffer( 10 );//not sure if this is nessecary
wcscpy( p, L"Name: "+(szChoice)); //copying szChoice into p so I can cast(what else should I do)?

szChoice.ReleaseBuffer( );//not sure about this it was in a EVC example(What is it?)
const char *val = reinterpret_cast<const char="" *="">(p);//Casting p into a 'char' so I can print to file
//so I could try to use strcpy
AfxMessageBox (p); //gives the whole string (name:Rod) it i typed rod in combo box
strcpy(buffer2, val);//copying val into buffer 2
strcpy(buffer1, "Hello dude" );//copying string "hello dude" into buffer
WriteFile(hFile, buffer1, strlen(buffer), &dwBytesWritten, 0);//writing to file"hello dude
WriteFile(hFile, buffer2, (szChoice.GetLength()), &dwBytesWritten, 0);//*********Only writes first letter'N' I want it
//to write 'Name: Rod', what do I have to do?

CloseHandle(hFile);
}

hFile = CreateFile(L"\\My Documents\\my_file.txt", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
}

I don't get it!!!!! When I switch the order that the buffers write, say write buffer 2 first then it only writes "N" and never gets to writing buffer1, if I write the buffer1 first it writes "hello dudeN". It is like when it gets to buffer2 it stops running and will only write one charactor.
GeneralRe: printing to a text file...HELP PLEASE Pin
Jonas Larsson6-Apr-04 3:40
Jonas Larsson6-Apr-04 3:40 
GeneralNewbie Looking for Help Pin
tracymc31-Mar-04 8:17
tracymc31-Mar-04 8:17 
GeneralRe: Newbie Looking for Help Pin
João Paulo Figueira31-Mar-04 22:05
professionalJoão Paulo Figueira31-Mar-04 22:05 
GeneralShell execute vs. Create Process Pin
RB@Emphasys31-Mar-04 8:02
RB@Emphasys31-Mar-04 8:02 
GeneralRe: Shell execute vs. Create Process Pin
Daniel Strigl31-Mar-04 19:40
Daniel Strigl31-Mar-04 19:40 
Generalaccess PocketPC files from PC Pin
badzio31-Mar-04 2:09
badzio31-Mar-04 2:09 
GeneralRe: access PocketPC files from PC Pin
João Paulo Figueira31-Mar-04 3:40
professionalJoão Paulo Figueira31-Mar-04 3:40 
GeneralADO Sample Pin
arlevand30-Mar-04 21:51
arlevand30-Mar-04 21:51 
GeneralRe: ADO Sample Pin
João Paulo Figueira31-Mar-04 0:19
professionalJoão Paulo Figueira31-Mar-04 0:19 
GeneralBluetooth connection...... Pin
Deepa Gopal29-Mar-04 20:36
Deepa Gopal29-Mar-04 20:36 
GeneralProblem with Virtual List View Pin
Bui Huy Kien29-Mar-04 18:06
Bui Huy Kien29-Mar-04 18:06 
GeneralRe: Problem with Virtual List View Pin
Daniel Strigl29-Mar-04 19:00
Daniel Strigl29-Mar-04 19:00 
GeneralRe: Problem with Virtual List View Pin
João Paulo Figueira29-Mar-04 21:04
professionalJoão Paulo Figueira29-Mar-04 21:04 
GeneralRe: Problem with Virtual List View Pin
Bui Huy Kien29-Mar-04 22:17
Bui Huy Kien29-Mar-04 22:17 
GeneralRe: Problem with Virtual List View Pin
João Paulo Figueira29-Mar-04 22:28
professionalJoão Paulo Figueira29-Mar-04 22:28 
GeneralRe: Problem with Virtual List View Pin
Bui Huy Kien30-Mar-04 1:00
Bui Huy Kien30-Mar-04 1:00 
QuestionHow To Localize the Menu??? Pin
Rassul Yunussov29-Mar-04 0:22
Rassul Yunussov29-Mar-04 0:22 

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.