|
Do your requirements require a C-style implementation? That is, why not use the standard C++ libraries?
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Your code was incomprehensible and you didn’t explain properly what you were trying to do so I took a guess. You should spend some more effort making you code intelligible, especially if you’re asking others to look at it. Anyway forget about old C functions such as “fgetc” and raw arrays. Here’s my program in C++:
----------------------
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
int main(int argc, char *argv[])
{
using namespace std;
// Open the input file.
ifstream iff("C:\\a.txt");
if (!iff)
{
cerr << "Failed to open input file!" << endl;
return 1;
}
// We'll store the file's contents in a 'vector' of 'string's.
typedef vector<string> FileContents_t;
FileContents_t fileContents;
// Read in the file line by line and add each line to 'fileContents'.
string line;
while (getline(iff, line))
{
fileContents.push_back(line);
}
// Now we can access any character in the file by its row and column.
unsigned int column = 5;
unsigned int row = 4;
if (row>=fileContents.size())
{
cerr << "Row out of range!" << endl;
return 1;
}
const string &ourRow = fileContents[row-1];
if (column>=ourRow.size())
{
cerr << "Column out of range!" << endl;
return 1;
}
char c = ourRow[column-1];
// Output the results.
cout << "Char at row " << row << " column " << column << " is " << c << endl;
return 0;
}
Steve
|
|
|
|
|
Thanks Steve and all the people who contributed for my C++ fiasco...
|
|
|
|
|
hi all,
CMAPIAdviseSink::OnNotify(...) will give the notification of email, Please let me know the steps to be followed to get the Notification of Messages when a Mail is Send to your computer.
Uday kiran
|
|
|
|
|
See here.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi!
How can I take path to current folder.
Example.
I rum my program from c:\Program\Demo\
How can I take this path.
|
|
|
|
|
|
maybe I should hit my refresh button more often :p
|
|
|
|
|
.... LOL .....
Regards
Programm3r
|
|
|
|
|
Work
Tank You very much!
|
|
|
|
|
|
GetCurrentDirectory();
KIRAN PINJARLA
|
|
|
|
|
Retrieves the current directory for the current process.
<br />
DWORD GetCurrentDirectory(<br />
DWORD nBufferLength,<br />
LPTSTR lpBuffer<br />
);<br />
Regards
Programm3r
|
|
|
|
|
<br />
GetModuleFileNameEx()
GetCurrentDirectory()
SetCurrentDirectory()
GetWindowsDirectory()
GetSystemDirectory()
|
|
|
|
|
Hi,
I need send mouse message (click, mouse move...) to child window. I have main dialog and this
have child dialog. Do you know whether exist some automatic message??? Or I must send these messages
to the Child by mean code??
Thanks
|
|
|
|
|
majco333 wrote: Do you know whether exist some automatic message???
What do you mean by this?
you can use SendMessage, given handle to window, for sending messages to that window.
|
|
|
|
|
Whether do not exist some message or switch whitch send messages from parent to child..
I have child window in ActiveX control
|
|
|
|
|
What do you need,exactly?and see SendMessage(...) (WM_LBUTTON*)and do you want to send one message (WM_MOUSEOVER) from main dialog to child dialog,right?
|
|
|
|
|
I need to handle mouse move when is out of child window too...
I handling mouse move in Child window but when I am with mouse out of child window, do not go me message... Do you know how do it?
|
|
|
|
|
majco333 wrote: I need to handle mouse move when is out of child window too...
Why this is required, can you explain ?
You can trck when mouse leave message, but not sure about other.
|
|
|
|
|
|
WM_MOUSELEAVE, when mouse leaves the windows client area
|
|
|
|
|
ON_MESSAGE(WM_MOUSELEAVE,OnMouseLeave) is not function me
|
|
|
|
|
majco333 wrote: ON_MESSAGE(WM_MOUSELEAVE,OnMouseLeave) is not function me
you need to use TrackMouseEvent
Refer this article[^]
You will get idea of using it.
|
|
|
|
|
But I need Point when I out of Child window... I do not need timer...
|
|
|
|