|
MsmVc wrote: yes i have a file a.txt and no i want to set file a.txt size through edit box.I mean when user set it size is 10kb or 20kb then it will affect on file.Plz help me
I don't get it. You have a file and you want to increase/decrease its size? Like padding or something? Can you show us the code you have so far?
|
|
|
|
|
ok
FILE *fleCredentials;
try {
fleCredentials = fopen("abc.txt", "w+");
fprintf(fleCredentials, "%s \n",m_password1);
fprintf(fleCredentials, "%s\n",m_repassword1);
fclose(fleCredentials);
}
catch(...)
{
AfxMessageBox("Could not validate the credentials");
}
Now i want to set the file size of abc.txt through edit box.
Plz help me
|
|
|
|
|
MsmVc wrote:
Now i want to set the file size of abc.txt through edit box.
So just get the value from the edit control via GetWindowText() , then call fseek() to position the file pointer beyond the end of the file. Write your data there.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
MsmVc wrote: How can i set the file size
That doesn't make sense: the size of a file depends on how many bytes you write into.
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]
|
|
|
|
|
Do you want to show size of file on the editbox or change size of a file?
|
|
|
|
|
Thanks for reply
I want to set the file size through edit box.See my currect file size is 10mb.No i want to change it's size 10mb to 20mb.So now i write the 20mb in edit box.Can i do that.
Plz help me
|
|
|
|
|
But MsmVc your question is like a sql question to change size of database and log& data files but I think its not possible however you can use of it for text file with insert blank space to them but can you tell me why you want to do it?
|
|
|
|
|
ok i am creating a log file.And i have given a option hich have set the file size.I am doing for this becouse user can set the log file size according to need.So plz help me
|
|
|
|
|
No no I said its on the databases when you set an default site for log and data files but after some times you want to increase size of databse its not for files.
If you tell me what do you want to do and why you want to increase size of file I can help you better.
|
|
|
|
|
Please see CFile::SetLength.
|
|
|
|
|
MsmVc wrote: Can i do that.
Yes. See here.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi all,
I m using a SDI type application,here Shortcut for select all "Ctrl+A" not working .
please tell me how can i use it.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Press down the 'CTRL' key and then, while still holding the ctrl key down, press the 'A' key.
|
|
|
|
|
PJ's answer is 100% right if you are using an application someone wrote (and I wish I'd replied that pithily). Or you could ask on a forum dedicated to ThatAppOverThere(tm). You wouldn't come to this forum asking how to press save in notepad?
If you are writing this application, then you need to look at Accelerators (do a search in your msdn docs)
Iain.
|
|
|
|
|
I m using it in Edit box control,But its not working its not select all data and its gives an beep when i use it.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
You should read what Iain wrote. The Ctrl-A combination is not built into the Edit Control.
|
|
|
|
|
Hi,
I am working on mfc and in my application i have a requirement to fire the handler which i have made for a button click event from within the code without clicking the button.
I need the button click handler to be called from my code.
please help me.
Thanks In Advance
|
|
|
|
|
Dhiraj kumar Saini wrote: I need the button click handler to be called from my code.
So call it.
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]
|
|
|
|
|
how to call it should i use SendMessage and pass my own created WindowMessage
|
|
|
|
|
If you want to click it yourself without click on the button yes you can use of SendMessage.
|
|
|
|
|
Double click on button on the form.
|
|
|
|
|
If you are working with MFC you can just create the function of the OnButtonClick using the Wizard (if you are not so self confident to make it by yourself) and then just call the function where you want, when you want.
For example:
in your view/dialog header
public:
enum { IDD = IDD_MY_VIEW};
CButton m_cbTest;
.
.
afx_msg void OnBTestClick();
DECLARE_MESSAGE_MAP()
and in your code file
void CYourView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
DDX_Control(pDX, IDC_BTEST, m_cbTest);
}
BEGIN_MESSAGE_MAP(CYourView, CFormView)
ON_BN_CLICKED(IDC_BTEST, OnBTestClick)
END_MESSAGE_MAP()
and after...
void CYourView::OnBTestClick()
{
your code...
}
and then you can call the OnBTestClick when you want
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Hi all,
I'd like to know if it would supose some optimization to use /OPT:WIN98 setting in Visual Studio 2005 / 2008 with XP / Vista as target operating system.
Thanks.
|
|
|
|
|
Very less people run Windows 98, so give them a separate build with /OPT:WIN98 linker option.
Otherwise, always build with /OPT:NOWIN98.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Yes I agree, but my question was, if still would be useful to make code 4K aligned? It makes some improvement to run aligned code in XP or Vista? or depends on fat32 / NTFS?
Thanks for replying.
|
|
|
|