|
Please help me!!! Can any one tell me how to delete a line in text file. Please tell me how to do it in C (not MFC, C++)
Thanks...
If you have faith in the cause and
the means and in God, the hot
Sun will be cool for you.
|
|
|
|
|
You can't. What you have to do is read the file in memory, erase the line and write the complete file back. An alternative is to open a temporary file, write line by line in it (except for the line you want to remove), delete your original file and then rename your new file.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
I cannot take big data inside memory because I may have 1 Lakh records to be written to the file. I cannot also use temp file because I may to exchange data from original file to temp file alteast 50,000 times.
If you have faith in the cause and
the means and in God, the hot
Sun will be cool for you.
|
|
|
|
|
|
There is no way of doing that.
Mmmh, I think there is problem with your design: if you have to update files so many times, I don't think this is the right choice. Can't you use a database for that ?
What is the purpose of this file exactly ?
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Requirement is we have to query data from database and modify the recordsets and write the data into the text file.
If you have faith in the cause and
the means and in God, the hot
Sun will be cool for you.
|
|
|
|
|
An optimization is to write the remaining file from the point of the deleted data rather than the entire file.
Bahadur - yar - Jung wrote: I cannot take big data inside memory because I may have 1 Lakh records to be written to the file.
Use buffered IO
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
hi
how can i change the background color of a slider ctrl.
can anybody help me?
thanx
nirmal
|
|
|
|
|
nirmal wrote: how can i change the background color of a slider ctrl.
can anybody help me?
HBRUSH CEttDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if (pWnd==GetDlgItem(IDC_SLIDER1))
{
hbr=CreateSolidBrush(RGB(123,123,13));
}
return hbr;
} Here IDC_SLIDER1 is the control ID of Slider control.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Is it possible to create in C++ the equivalent of the command window in matlab, i.e. a window ( the command prompt I guess), that would be launched at the beginning of a debbug session. While the debug is paused at the breakpoint, a chosen operation ( say viewing the value of an object) could be invoked on some object ( say "Matrix A")in the current namespace, by typing the corresponding command in that window ( say "View(A)") that would return the entries fo matrix A. One could also think of the computation of the condition number of that matrix, while the debug is stopped at the breakpoint, throught the command "cond(A)".
Any suggestion greatly appreciated
McBridou
-- modified at 8:45 Tuesday 23rd May, 2006
|
|
|
|
|
Hi
How I can draw animation on the desktop window (like Sheep or snow or MSAgent program)?
Thanks
|
|
|
|
|
1)Create a transparent window and draw over it.
2)If you want to draw directly over the desktop you can use GetDesktopWindow()
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thank you, but
1) Drawing just one bitmap in transparent window is ok, but second one makes problem
2)it has same problem (redrawing previous area?)
|
|
|
|
|
Hadi Dayvary wrote: 1) Drawing just one bitmap in transparent window is ok, but second one makes problem
2)it has same problem (redrawing previous area?)
Use proper raster operation of drawing ..
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hadi Dayvary wrote: How I can draw animation on the desktop window (like Sheep or snow or MSAgent program)?
http://www.codeproject.com/com/msagent.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Thank you
I don't wanna use MSAgent, I want to write same program, an Agent editor and a dialog for showing it.
|
|
|
|
|
hi,
i have a CTreeCtrl derived class CTreeCtrlEx. in it i have the OnSelchanged().
My Msg loop:
ON_NOTIFY_REFLECT(TVN_SELCHANGED, OnSelchanged)
my problem is that the OnSelchanged doesnt fire sometimes!!
What is causing this? Any ideas? Thnx in advance...
|
|
|
|
|
Hi
I have a _bstr_t object and I need to convert it into a string and use it as an argument for cout. How do I convert it?? Please provide me some example for this conversion
-- modified at 8:21 Tuesday 23rd May, 2006
|
|
|
|
|
koumodaki wrote: I have a _bstr_t object and I need to convert it into a string and use it as an argument for cout. How do I convert it?? Please provide me some example for this conversion
cast _bstr_t object to char*
_bstr_t g("alok");
std::cout<<(char*)g;
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
|
C++
Hi i have a function FTPcommand(CString command)
FTP
i want to give the command "put filename"
but because the filename got spaces (An Example.mp3)
i have to give the command "put "An Example.mp3""
C++
(Variable CString Filetitle = "An Example.mp3")
I type FTPcommand("put """+Filetitle);
I think i am wrong.If i am how i can type it so it would be correct?
|
|
|
|
|
|
Immunity18 wrote: I type FTPcommand("put """+Filetitle);
CString cmd;
cmd.Format("put \"%s\"",Filetitle);
FTPCommand(cmd)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I didn't clearly understood your question but if you want to use a " character inside a string, you can use '\"' as an escape sequence:
char* szString = "A string with a \" in it";
This will give you that if you print it:
A string with a " in it
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Cedric Moonen wrote: didn't clearly understood your question but if you want to use a " character inside a string, you can use '\"' as an escape sequence:
You lose the race today; don't strain your nose much
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|