|
hi guyz ..
how can i can input from .dat or .txt using getline statment ?
with unlimited size of memory ?>
|
|
|
|
|
dr.nokia wrote: how can i can input from .dat or .txt using getline statment ?
What is your trouble about?
dr.nokia wrote: with unlimited size of D'Oh! memory ?>
Uh! Who gave you that?
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]
|
|
|
|
|
coz i've assignment project about morse code read input from I/O file
|
|
|
|
|
Interesting, anyway, you didn't ask neither of my questions.
Good luck with your assignment.
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]
|
|
|
|
|
i want to use with unlimited size coz i don't know how the msg big is !!
|
|
|
|
|
Obviously you haven't memory of unlimited size. If your file is reasonably small then you may allocate memory to read the whole file, otherwise you need to read the (big) file in chunks.
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]
|
|
|
|
|
dr.nokia wrote: how can i can input from .dat or .txt using getline statment ?
Something like:
ifsstream ifs;
string line;
while (getline(ifs, line))
{
...
}
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
In VC++ 6.0 MFC application
i am trying to Display date in Shot Format eg;05-10-09
but it will print 05-10-2009
Here is the code i written
SYSTEMTIME st;
GetSystemTime(&st);
CString str;
str.Format("%02d-%02d-02%d",st.wDay,st.wMonth,st.wYear);
m_date=m_date + str;
I will get output say eg: 05-10-2009, but i want in this format 05-10-09
Plz any body help me
|
|
|
|
|
|
_tcsftime()[^] or CTime::Format()[^] to format date/time in required format how we can use it i am not getting plz will give the example
|
|
|
|
|
Hello Jiya,
if you have trouble with those apis, then use COleDateTime. Check the sample code snippet for your use,
COleDateTime time = COleDateTime::GetCurrentTime();
CString str = time.Format(_T("%d-%m-%y"));
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
jiya-123 wrote: I will get output say eg: 05-10-2009, but i want in this format 05-10-09
Have you tried:
str.Format("%02d-%02d-%02d",st.wDay,st.wMonth,st.wYear%100);
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
how to put node at the end of list. I have so:
struct element{<br />
int key;<br />
int idx;<br />
element *prev, *next;<br />
};
in main i have:
<br />
element* head=NULL; ->pointer on begging<br />
element* tail=NULL; ->pointer on end<br />
element* new=NULL; ->pointer for new node<br />
<br />
int el;<br />
new=new element;<br />
<br />
cin>>el;<br />
nov_el->key=el;<br />
add(head,new,tail); <br />
I know how to put node at the beggining:
<br />
void vstavi(element*&head, element* new, element*&tail)<br />
{<br />
new->prev=NULL;<br />
new->next=head;<br />
<br />
if(head!=NULL)<br />
{<br />
head->prev=new;<br />
}<br />
<br />
else<br />
tail=new;<br />
head=new;<br />
<br />
}<br />
How to change this code for adding on beggining so it will add on the end. And everytime new node is added to the end idx from structure element must idx=idx+1;
Thanks a lot
|
|
|
|
|
Please use the code block button to post code snippets.
It looks like you aren't completely aware about C++ syntax: new is a keyword (hence a reserved identifier), moreover if you wish (as it appears) execute both the statements
Aljaz111 wrote: tail=new;
head=new;
after the else clause the you've to enclose them in a block ({} ).
Please fix your code, be sure it compiles and works and then ask for completion.
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]
|
|
|
|
|
i know..i just want to give good name for new element i my code i have nov_el;)
|
|
|
|
|
What's problem? Code is simple.
void addTail(element*&head, element* new, element*&tail)
{
new->next=NULL;
new->prev=tail;
if (tail!=NULL)
{
tail->prev=new;
new->idx=tail->idx+1;
}
else
{
head=new;
new->idx=0;
}
tail=new;
}
Do not trust a computer...
Always check what computer is doing
regards,
Divyang Mithaiwala
Software Engineer
|
|
|
|
|
Divyang Mithaiwala wrote: Do not trust a computer...
Always check what computer is doing
As well as don't trust your mental compiler: new , you know, is a C++ keyword hence, as it stands, your code won't compile.
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]
|
|
|
|
|
Hi There.
I am using VS2008, and am facing above problem.
For details, below is what I am doing...
CString strSource = L"Hello";
TCHAR SourceFile[] = strSource;
Please suggest.
Thanks
PanB
|
|
|
|
|
Found a Solution: Above conversion can be done using _tcscpy function.
Eg:
CString strSource = L"Hello";
TCHAR SourceFile[100];
_tcscpy(SourceFile, strSource );
|
|
|
|
|
Your solution only works on UNICODE builds.
On the other hand, you may easily generalize it with
CString strSource = _T("Hello");
TCHAR SourceFile[100];
_tcscpy(SourceFile, strSource );
to work both in UNICODE and in ANSI builds.
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]
|
|
|
|
|
Why do you need it?
Are you sure you need to convert a wide char string into a generic text mappings array?
If the answer to the second question is yes then you need something like:
HRESULT hr;
TCHAR SourceFile[0x100];
CString strSource = CString(L"Hello");
hr = StringCbCopy(SourceFile, sizeof(SourceFile), strSource);
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]
|
|
|
|
|
MFC, STUDIO 2008, MDI-project
advanced to forward, 2 errors became less:
#pragma once
class СAdderDialog; // after addition this line into file "modeldlg.h" eliminate (remove)only 2 errors
// CMainDlg
class CMainDlg : public CDialog
{
СAdderDialog* m_pModeless5;
CMainDlg::CMainDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMainDlg::IDD, pParent)
, m_pModeless5(NULL)
{
. . . . . . . . . . .
void CMainDlg::OnOK()
{
if (m_pModeless5 == NULL) // OK!
{
m_pModeless5 = new CAdderDialog(this); // error C2440: '=' : cannot convert from 'CAdderDialog *' to 'СAdderDialog *'
if (m_pModeless5->Create() == TRUE) // modeldlg.cpp(67) : error C2027: use of undefined type 'СAdderDialog'
// error C2227: left of '->Create' must point to class/struct/union/generic type
GetDlgItem(IDOK)->EnableWindow(FALSE);
}
else
m_pModeless5->SetActiveWindow(); // error C2027: use of undefined type 'СAdderDialog'
}
|
|
|
|
|
Have you considered including the header wherein CAdderDialog is declared?
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]
|
|
|
|
|
For language teaching a student hears a word and then repeats it.
That gives me two wave-files, the first is my own, the second the one recorded by the student.
That one will probably start end end with noise, of which I don't know the amplitude.
The noise may also contain peaks (dropping a pen on the desk).
I can't determine the exact start and end of the spoken word because of possible peaks
and because the word may start and end 'under' the noise level.
I must compare the two waves, which are in two short-int arrays, to see if the student
pronounced the word correctly, based on rhithm, pitch and stress.
So, 'rotor' in reply to 'motor' would be correct, but 'rotter' would not.
Comparing the content of the waves doesn't work, so now I am wondering if using FFT
might be the solution. I have tried WaveInFFT, processing the two arrays the same way and
dispaying them in the same way, but do not see a resemblance between the two graphs.
I hope someone can point me in the right direction.
Ronald Wilmink (Netherlands)
modified on Friday, April 10, 2009 9:32 AM
|
|
|
|
|
Hi All,
Can anyone tell me how to get model number, serial number,temperature and other S.M.A.R.T features of external hard disk drive using MFC.
Thanks
|
|
|
|