When I have the button clicked, how do I get the entered text from each EDITBOX I have and save it to a file?
When I have the button clicked, how do I get the entered text from each EDITBOX I have and save it to a file?
Website(s): http://www16.brinkster.com/trifaze/
E-mail: [email protected]
---------------------------------
C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
DirectX Version: 9.0b
DX SDK: DirectX 8.1 SDK
Try using either
or....Code:char mytext[100]; FILE *fptr; fptr = fopen("c:\\somefile.txt", "w"); GetWindowText(hwnd, mytext, 99); fprintf(fptr,mytext); fclose(fptr);
try one or the other.Code:char mytext[100]; FILE *fptr; fptr = fopen("c:\\somefile.txt", "w"); GetDlgItemText(hdlg, ID_EDIT1, mytext, 99); fprintf(fptr,mytext); fclose(fptr);
I tried:
FILE *theSave, but I got:
229 book15.cpp
'FILE' undeclared (first use this function)
'theSave' undeclared (first use this function)
Website(s): http://www16.brinkster.com/trifaze/
E-mail: [email protected]
---------------------------------
C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
DirectX Version: 9.0b
DX SDK: DirectX 8.1 SDK
Did you #include <stdio.h> ?
What do I do? I got it to save but in the file, it doesn't show my variables for the GetWindowText.
Website(s): http://www16.brinkster.com/trifaze/
E-mail: [email protected]
---------------------------------
C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
DirectX Version: 9.0b
DX SDK: DirectX 8.1 SDK
try
fprintf(fptr,"%s",mytext);
I have many variables. How would I put them all in?
Website(s): http://www16.brinkster.com/trifaze/
E-mail: [email protected]
---------------------------------
C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
DirectX Version: 9.0b
DX SDK: DirectX 8.1 SDK
What're you talkin about? you mean you need to save from a buncha edit boxes?
Yes. Can I do it?
Website(s): http://www16.brinkster.com/trifaze/
E-mail: [email protected]
---------------------------------
C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
DirectX Version: 9.0b
DX SDK: DirectX 8.1 SDK
where there's a will, there's a way. Just create a new string for each editbox, plus a cumulative one. Sorta like this...
char text1[100], text2[100], text3[100], cumulative[300];
/*call GetWindow/DlgItemText() for each string (except cumulative)*/
then go
sprintf(cumulative,"%s%s%s",text1,text2,text3);
THEN
fprintf(fprt,"%s",cumulative);
fclose(fptr);
there ya go
Last edited by -KEN-; 10-16-2001 at 07:09 PM.
Try using CreateFile() ect instead of fopen().
You are using WIN32 API, not the old C. Why mix them up?
IF you are using C not C++ or MFC.
Try in the callback
When the dialog closes or user clicks on the SAVE control ect, check that all the edit buffers have valid data and then assemble into a file using WriteFile()Code:case IDC_MYEDIT: if (EN_CHANGE ==HIWORD(wParam)) GetDlgItemText(hwnd,IDC_MYEDIT,sBuffer,64); break;
PS Your 14 and taken? By what Gypsies, Sharks, Flights of Fancy?
Last edited by novacain; 10-17-2001 at 01:35 AM.
%d 14 and taken means I have a girlfriend..LoL %d
Website(s): http://www16.brinkster.com/trifaze/
E-mail: [email protected]
---------------------------------
C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
DirectX Version: 9.0b
DX SDK: DirectX 8.1 SDK