|
Yes that's what I'm trying to do, but waht is strtol()? and how do I use it.
Thanks
|
|
|
|
|
aflothmann wrote: ...waht is strtol()? and how do I use it.
See here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
want to store data in txt file my code works fine but i dont want to uppend the record in that,so is there any function which will alwyas overwright the txt file and not do the uppend
<br />
if(txtMarket == "EURUSD")<br />
{<br />
m_MainEdit_EUR =m_MainEdit_EUR + Market +"," + Bid +","+ b +","+ Ask +","+ c +","+ High +","+ Low +","+ d +","+ Timestamp+"\n";<br />
myfile.Open("EurUsd.txt",CFile.modeCreate | CFile.modeWrite);<br />
LPSTR buf;<br />
int i = m_MainEdit_EUR.GetLength();<br />
buf = m_MainEdit_EUR.GetBuffer(i);<br />
myfile.Write(buf,i);<br />
myfile.Close();<br />
}<br />
<br />
TXT FILE OUTPUT I AM GETTING
<br />
EURUSD,1.2677,D,1.2680,D,1.2696,1.2679,1,01:20<br />
EURUSD,1.2676,D,1.2679,D,1.2696,1.2679,1,01:21<br />
EURUSD,1.2677,U,1.2680,U,1.2696,1.2679,1,01:21<br />
EURUSD,1.2676,D,1.2679,D,1.2696,1.2679,1,01:21<br />
EURUSD,1.2677,U,1.2680,U,1.2696,1.2679,1,01:22<br />
EURUSD,1.2676,D,1.2679,D,1.2696,1.2679,1,01:23<br />
EURUSD,1.2677,U,1.2680,U,1.2696,1.2679,1,01:23<br />
EURUSD,1.2678,U,1.2681,U,1.2696,1.2679,1,01:23<br />
EURUSD,1.2677,D,1.2680,D,1.2696,1.2679,1,01:23<br />
EURUSD,1.2676,D,1.2679,D,1.2696,1.2679,1,01:23<br />
EURUSD,1.2677,U,1.2680,U,1.2696,1.2679,1,01:23<br />
<br />
expecting output<br />
EURUSD,1.2677,U,1.2680,U,1.2696,1.2679,1,01:23<br />
It will always update by last record.
Do you have any suggestion
|
|
|
|
|
abrakadbra wrote: m_MainEdit_EUR =m_MainEdit_EUR + Market +"," + Bid +","+ b +","+ Ask +","+ c +","+ High +","+ Low
I think this line is the problem. You are always concatenating to an existing string.
I guess it should be
m_MainEdit_EUR = <code>m_MainEdit_EUR +</code> Market +"," + Bid +","+ b +","+ Ask +","+ c +","+ High +","+ Low +","+ d +","+ Timestamp+"\n"; You are appending to the previous buffer that you had. You should clear it first and then assign.
|
|
|
|
|
no it is not working..it state the error
: error C2110: cannot add two pointers
|
|
|
|
|
abrakadbra wrote: no it is not working..it state the error
: error C2110: cannot add two pointers
Yeah it will not work if Market is itself a pointer...
Try this...
m_MainEdit_EUR = "";
m_MainEdit_EUR = m_MainEdit_EUR + Market +"," + Bid +","+ b +","+ Ask +","+ c +","+ High +","+ Low +","+ d +","+ Timestamp+"\n"; This will work.
|
|
|
|
|
|
I agree with ThatsAlok use of CString:Format instead for example str="1"+"2"+"3"...
|
|
|
|
|
abrakadbra wrote: m_MainEdit_EUR =m_MainEdit_EUR + Market +"," + Bid +","+ b +","+ Ask +","+ c +","+ High +","+ Low +","+ d +","+ Timestamp+"\n";
In Continuation with Mr Thomas,
what about
m_MainEdit_EUR.Format(_T("%s,%s,%s,%s,%s,%s,%s,%s,%s\n"),Market,Bid,b,Ask,c,High,Low,d,Timestamp);
"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
Support CRY- Child Relief and You
|
|
|
|
|
Hello everyone!
OK, so I'm wasting my last daily forces surfing the Web, and I find this X-Face[^] thing... Then I get an idea for a program. When I first saw a code string, I thought each character represented a pixel, but no... Anyone know how it works? Somehow it reminds me of file checksums... Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
The link doesn't work. Looks like it's got too many "http"s.
Steve
|
|
|
|
|
|
|
Yeah, but do you know somewhere that tells you how to do it manually? I'm not doing an X-Face program, but something of my own, so I want to know how they can convert a string of chars to a 48x48 image, since whenever I change a character the whole image's distorted... Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
I am writing one simply aplication , and need conect to one webpage, and obtain the text. how?
Greets.
P.D: I´m using VS C++ .net 2003 for aplication form
|
|
|
|
|
|
Hey,
I've got an SDI MFC application that initialises a Direct3D Device inside one of the View Classes.
CApp >> CMainFrame >> CView >> DirectX
I'm also using the basic View switching model(no splitter Wnd) taken straight from Microsofts' sample program - 'swsplit', it basically copies a few pointers, deletes the existing View and then creates a new one.
The Problem:
If i use the main windows HWND :
InitD3D( AfxGetApp()->m_pMainWnd->GetSafeHwnd() );
It works correctly all the time but the D3D device floats on top of the toolbars and statusbar, i guess because it's attached to the main window not the child window.
however, if i do it the way i want and use the CViews HWnd :
InitD3D( GetSafeHwnd() );
It will only work when the view class is created by the MFC framework at startup, as soon as i switch the view class and then switch back Direct3D fails to start and gives the error: 'Internal Driver Error'
Any ideas what i'm missing
Thanks
|
|
|
|
|
I have a list of key/value pairs stored in the registry, Each key/pair is a filename for a file that is available to my application. If a user deletes a file, I want to also delete the key from the registry. So I am creating a function to iterate through the registry deleting the value if it does not exist. RegQueryInfoKey() and RegEnumValue() seem to be the functions I need. But the spec for RegEnumValue() is a bit confusing.
While using RegEnumValue, an application should not call any registry functions that might change the key being queried.
Does this mean I cannot delete the key within the loop (how does deleting effect the remaining values?), or is it safe to delete? If the former, I would have to build an array of all keys flagged for delete which I would prefer to avoid.
|
|
|
|
|
>>Does this mean I cannot delete the key within the loop
Yes!
|
|
|
|
|
It's similar to iterating through an STL collection - if you change the collection, any iterators may become invalid. What could happen in the registry, if you delete values while enumerating, is the enumeration will skip some values.
|
|
|
|
|
When enumerating, the docs say to pass 0 on the first call and to increase it each time after, just a standard loop. What I'm asking is, if I start this loop, increasing the index each time, then when I find a certain key I want to delete, is it safe to delete (NOT increasing the index will cause it to point to the next value). This is the same method I would deal with any dynamically resizing array such as a vector. My main concern is, if I delete the key, will the other keys rearrange themselves?
I don't really want to use two loops because the registry is already slow, there may be up to a hundred keys to iterate through.
|
|
|
|
|
If the behavior isn't documented in MSDN, I wouldn't rely on it.
|
|
|
|
|
Thats what I thought, still better to ask and be sure though. Thankyou.
|
|
|
|
|
Why do you even need to call RegEnumValue() ? Since you know where the key/value pairs are stored, can you not just call RegDeleteValue() ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Why do you even need to call RegEnumValue()? Since you know where the key/value pairs are stored, can you not just call RegDeleteValue()?
Because at runtime I don't know the keyname for any of the values. Basically, I have built a script engine into my project. This engine compiles scripts and stores them. In an attempt to make it more difficult for the user to cheat, I create a CRC-32 hash of the script file and then use this as both a reg key and filename. I need to enumerate the registry because A user may have deleted a compiled file thus leaving the key un-resolvable.
This function I am creating runs only once during execution and eliminates any discrepancies in the registry.
|
|
|
|
|