|
Respected all
Regards!
the last time i recieved the answers of my query was not a professional way. that's y i m sent again
how i can read data from a data file which has extenstion is *.Dat which is in the follwing format
---------------------------
filename.dat
data file
genertaed from the processing of the control system
dfgdfgdfg cgb fbgd
345345 dgdfg
dgdfg
XLOC YLOC INDIX
45 56 2344
56 67 1245
50 90 4562
45 87 9337
-----------------------------------------------------------------
and in the given data file i have to read only the data of columns under XLOC,YLOC,INDIX and the file always is in this format.
So please guide me.
waiting for + response.
david
|
|
|
|
|
FILE* fp;<br />
char x[20], y[20], index[20];<br />
int i;<br />
int ind;<br />
char buf[200];<br />
int len;<br />
fp = fopen("text1.dat","r");<br />
while (! feof(fp))<br />
{<br />
memset(buf,0,sizeof(buf));<br />
fgets(buf,200,fp);<br />
len = strlen(buf);<br />
if (len == 0)<br />
continue;<br />
<br />
memset(x,0,sizeof(x));<br />
memset(y,0,sizeof(y));<br />
memset(index,0,sizeof(index));<br />
<br />
ind = 0;<br />
i = 0;<br />
while (i < len)<br />
{<br />
if (buf[i] == ' ')<br />
break;<br />
x[ind] = buf[i];<br />
ind++;<br />
i++;<br />
}<br />
i++;<br />
ind = 0;<br />
while (i < len)<br />
{<br />
if (buf[i] == ' ')<br />
break;<br />
y[ind] = buf[i];<br />
ind++;<br />
i++;<br />
}<br />
i++;<br />
ind = 0;<br />
while (i < len)<br />
{<br />
if (buf[i] == ' ')<br />
break;<br />
index[ind] = buf[i];<br />
ind++;<br />
i++;<br />
}<br />
<br />
MessageBox(x);<br />
MessageBox(y);<br />
MessageBox(index);<br />
<br />
}<br />
fclose(fp);
What you need to do is string-processing, not some filing technique.
I hope it works.
this is this.
|
|
|
|
|
a_david123 wrote:
the last time i recieved the answers of my query was not a professional way.
This example works. Why haven't you tried it?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
i am trying to create a windows explorer type application in vc++.i am able to update the TreeView for the directory list. But i am unable to populate the ListView(right pane).i have listed the code below..
void CDirTreeDemoView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
GetListCtrl ().InsertColumn (0, _T ("File Name"), LVCFMT_LEFT, 192);
GetListCtrl ().InsertColumn (1, _T ("Size"), LVCFMT_RIGHT, 96);
GetListCtrl ().InsertColumn (2, _T ("Last Modified"), LVCFMT_CENTER,128);
}
any help plz
thanks
|
|
|
|
|
<br />
BOOL CDirTreeDemoView::PreCreateWindow(CREATESTRUCT& cs)<br />
{<br />
cs.style |= LVS_EDITLABELS | LVS_REPORT;<br />
return CListView::PreCreateWindow(cs);<br />
}<br />
<br />
void CDirTreeDemoView::OnInitialUpdate()<br />
{<br />
CListView::OnInitialUpdate();<br />
CListCtrl& refCtrl = GetListCtrl();<br />
CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());<br />
refCtrl.InsertColumn(0, _T("File Name"), LVCFMT_LEFT, 192);<br />
refCtrl.InsertColumn(1, _T("Size"), LVCFMT_RIGHT, 96);<br />
refCtrl.InsertColumn(2, _T("Last Modified"), LVCFMT_CENTER, 128);<br />
<br />
DWORD dwExListStyles = LVS_EX_FULLROWSELECT;<br />
GetListCtrl().SetExtendedStyle(dwExListStyles);<br />
}<br />
Maybe this will help
P.
|
|
|
|
|
Nithyb wrote:
But i am unable to populate the ListView
Why? What problem(s) are you having?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
hello...
supposed you have two bitmap images in your form, say bitmap1 and bitmap2... how can you get the difference(image subtraction) of the two images...
thank u in advanced....
|
|
|
|
|
First, you need to get the dimensions of the bitmaps, then allocate an appropriate array (wid*hei*bpp/8 bytes). Use the GetBitmapBits function to populate the array. Do the same with the second array. Subtract them byte by byte. Use the SetBitmapBits to fill the CBitmap.
Live long and in prosper
johny74656@gmail.com
|
|
|
|
|
I want to have a reset button on my dialog box which restore the control values to their original values.Any clue which function shud I call in the reset button function??
|
|
|
|
|
I usually keep the default values in a config file..then read in from the file and update to the control values. Not sure if this is the best method.
Aaron
|
|
|
|
|
I'd store the default values in an XML file that you'd load at the beginning
and then you'll have to reset each component one by one. The best automated thing you can do is to group all the edit box to have their resource id consequtive so the you'll be able to do in case you want to reset them:
for(int i = iFirstResId; i <= iLastResId; i++)
SetDlgItemText(i, "");
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Or use the UpdateData function sending in the right parameter (I can never remember if it's TRUE or FALSE). As long as you haven't called it yet to update the variables, calling it with the right parameter will put whatever the variables' value are back in the controls
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
If you've designed it properly, my suggestion would be to simply click the Cancel button and then open the dialog up again. All of the initial (default) values will be present at that point and you will not have had to resort to some "reset" button.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
How do i maintain the focus in a edit box? For example i was typing half-way in the edit box, however an event occur and the focus got changed. How do i set the focus to remain in the edit box.
This is wat i tried to do when the event occurs
<br />
if(m_alarmOn==false)<br />
{ <br />
m_alarmOn= true;<br />
<br />
CWnd* prev = this->SetFocus();<br />
prev->SetFocus();<br />
<br />
CreateThread(0,NULL,CSecurityDlg::playSound,this,0,0);<br />
}<br />
<br />
The above code reside in a OnBtnClick function. So when alarm is on, the button will be auto click....and the alarm sound goes off....
But in the process of these, i might be typing in a editbox. So i will lose the focus...How do i get it to stay?
Aaron
|
|
|
|
|
void APPDlg::OnKillfocusTextBox()
{
//set condtion here to see if the user has finshed typing..
//else do this,
m_TextBox.SetFocus();
}
u can never get out of ur textbox if u dont handle it correctly
V
|
|
|
|
|
Tks. I resolved it using pic control and defining a WM_action message instead. Thought this would be neater.
|
|
|
|
|
How do i include a header files directory of another library to my project's include file path.
|
|
|
|
|
Open the project settings.
Go to the C++ tab.
Use the combobox to go to the Preprocessor entry.
Under 'additional include folder' enter a relative or absolute path.
I prefer to use relative paths from the DSW file, since I might end up with a different drive letter or arrange items into different levels. Less work if things are relocated relatively to each other than a hard coded path to some specific drive in some specific rooted folder hierarchy.
|
|
|
|
|
Suppose im using an open source library borZoi-1.0.2.I copy its folder to my project and the header files r in
borZoi-1.0.2\src directory so what will b the relative path with respect to DSW file
|
|
|
|
|
hi,
i am trying to use the borzoi 1.02 with Visual studio 2008 C# .NET,
i am trying to use the ECC implementation in this library,
so how can i integrate this library and use its functions from within VS 2008 C#.
thanks alot
|
|
|
|
|
|
who can tell me about change the tcp/ip packet on ndis or spi,please give me
the code for example,thanks a lot!!!
riynivke
|
|
|
|
|
Hi,
Do anyone know will DDE(dynamic data exchange) still be supported
in window longhorn ?
Thank
|
|
|
|
|
Hi all,
While i use
CreateProcess(
LPCWSTR pszImageName,
LPCWSTR pszCmdLine,
LPSECURITY_ATTRIBUTES psaProcess,
LPSECURITY_ATTRIBUTES psaThread,
BOOL fInheritHandles,
DWORD fdwCreate,
LPVOID pvEnvironment,
LPWSTR pszCurDir,
LPSTARTUPINFOW psiStartInfo,
LPPROCESS_INFORMATION pProcInfo
);
I want to pass a structure as second parameter(pszCmdLine) in this function. But somehow child process can't correctly get the structure! Should i do anything like "cast" or.. before i pass it? thanks for any advice!
|
|
|
|
|
How do you plan to pass the data of the structure ? You can't just pass a pointer to the second process because the pointer is only valid in the context of the original process.
I think you need to pass the value of each member of the structure as a text string to the second process and it must parse the values and "re-assemble" the data structure.
|
|
|
|