|
ruilin Yang wrote: I found the program can not read all the lines.
How many lines are in the file? The while loop terminates when it encounters a \n character. Is this intentional?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I am using VC++ compiler.
My intention is to read a file completely. So my intension is to read until
the end of the file. I do not know what is the best symbol to put at
while(!(qq=="'\n'")). I tried a few different symbols, does't help.
Thanks
|
|
|
|
|
I think you need to use the eof() method instead. Something like:
while (! f_ptr1.eof())
{
f_ptr1.getline(...);
f_ptr2.write(...);
}
On a side note, are ruilin Yang and mrby123 one in the same?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi DavidCrow
You solved my problem. ruilin = mrby123
Thanks
By the way, I do not like the f_ptr1.getline (par1,par2,par3); I do not like to
specify the number of the characters or the third parameter ' '.
I like to use the string function: getline(f_ptr1,s), This looks more robust,
but it does not work. The compile do not know the function, even you can see
I have #include string
The program is funny, when I put #include iostream and #include fstream
I got :'ifstream' : undeclared identifier
I have to put: #include iostream.h and #include fstream.h
Then the program works. I do not understand why I can not use #include iostream.
-- modified at 12:39 Tuesday 14th March, 2006
|
|
|
|
|
Hello, i am a new in c++! i know c#, vb.net, java, asp.net but C++ i dont know nothing! how can i start my new project from because when i created a new project .. many items appeard I am using VB.net 2003
Adrian De Battista
|
|
|
|
|
ADY007 wrote: how can i start my new project...I am using VB.net 2003
You might want to start with a VC++ compiler.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I am using VC++ compiler.
My intention is to read a file completely. So my intension is to read until
the end of the file. I do not know what is the best symbol to put at
while(!(qq=="'\n'")). I tried a few symbols, does't help.
Thanks
|
|
|
|
|
yes but i can't see any VC++ Is it like console?
Adrian De Battista
|
|
|
|
|
it maight not have been installed with the other parts of your Visual Studio environment...
|
|
|
|
|
I made a console project with my VC++ 6.
|
|
|
|
|
Hi,
I currently porting some code from Linux to Windows. I have decided against a windows implementation of the POSIX threading libraries and opted for windows threading.
Previously in my code, I had conditional run conditions using the pthread_cond_t, is there an equivalent in the windows threading API?
Any help would be greatly appreciated,
Paul.
|
|
|
|
|
paul_a_chapman wrote: I have decided against a windows implementation of the POSIX threading libraries and opted for windows threading.
That was a mistake
paul_a_chapman wrote: I had conditional run conditions using the pthread_cond_t, is there an equivalent in the windows threading API?
Unfortunatelly, no, at least not directly. Look here[^] for a workaround.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Thanks for your reply, that link is useful. I did try using the win32 pthread libraries, but I kept getting exception errors. The code functions correctly on linux but not with the win32 pthreads library. The decision was made above me to use windows threading api.
Thanks again.
Paul.
|
|
|
|
|
1. barcode is drawn by lines (space and bar), why does it need font? font is useless when we draw lines.
2. what is correct width of bar or space? - i.e. 0.2 mm etc.
3. what is correct height of barcode?
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
includeh10 wrote: 1. barcode is drawn by lines (space and bar), why does it need font? font is useless when we draw lines.
See here.
includeh10 wrote: 2. what is correct width of bar or space? - i.e. 0.2 mm etc.
A barcode is comprised of bars and spaces. I believe the leftmost bar, which is one unit wide, sets the stage for the remaining bars and spaces.
includeh10 wrote: 3. what is correct height of barcode?
I believe it is governed by the product on which the barcode is placed. For example, a large box can afford to have a large barcode where as box of cookies could not. Another determining factor is how far will the scanner be from the box.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I'm writing an application, where I need to save links to external documents (.xls, .doc, .txt, ...). In Windows, when I double-click to such a file, it'll be opened automatically by the corresponding application.
double-click to test.xls opens Microsoft Excel
double-click to test.doc opens Microsoft Word
double-click to test.tif opens the corresponding graphical application
and so on...
How can I implement this functionality in my application, working under Visual C++ / MFC ?
regards
Alfred Willi
|
|
|
|
|
a type of file (extension) is associated with an application.
u can find all info about this in system register (run regedit.exe).
e.g. doc file can be opened by Microsoft word.
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
Alfred Willi wrote:
How can I implement this functionality in my application, working under Visual C++ / MFC ?
Use ShellExecute() with the "open" verb will open the associated application.
Otherwise, if you are wanting to know how to register your own file type, this is handled for you automatically by MFC's AppWizard. It will create a .reg file in your project that can be merged on the target machine. Check out CWinApp::EnableShellOpen() and CWinApp::RegisterShellFileTypes() .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi David
Your answer was exactly the information I was looking for. Your answer was very helpful for me. Thanks a lot.
Alfred Willi
|
|
|
|
|
Hello i am working with MFC. I want to display a full screen with blue color. I can give you an example. When Windows 2000 starts up. After booting it requires network password. At that time, Background is blue. I want to ask how can i do it?
Thank you.
We Believe in Excellence
|
|
|
|
|
Hi, I'm searching for a few days now for a tutorial of an example to see all the computers that are in my lan.
Does anybody has this for me?
Greetings,
Spike
|
|
|
|
|
Try NetServerEnum() .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I have this code, but it seems Visual Studio .Net has trouble with WNetOpenEnum, WNetEnumRecources and WNetCloseEnum.
CString strTemp;<br />
CListBox *pList = (CListBox*) GetDlgItem(IDC_LIST1);<br />
pList->ResetContent();<br />
<br />
struct hostent *host; <br />
struct in_addr *ptr;
<br />
DWORD dwScope = RESOURCE_CONTEXT;<br />
NETRESOURCE *NetResource = NULL; <br />
HANDLE hEnum; <br />
WNetOpenEnum( dwScope, NULL, NULL, NULL, &hEnum ); <br />
<br />
WSADATA wsaData; <br />
WSAStartup(MAKEWORD(1,1),&wsaData);<br />
<br />
if ( hEnum ) <br />
{<br />
DWORD Count = 0xFFFFFFFF;<br />
DWORD BufferSize = 2048;<br />
LPVOID Buffer = new char[2048];<br />
WNetEnumResource( hEnum, &Count, Buffer, &BufferSize );<br />
<br />
NetResource = (NETRESOURCE*)Buffer;<br />
<br />
char szHostName[200];<br />
<br />
for ( unsigned int i = 0; i < BufferSize/sizeof(NETRESOURCE); i++, NetResource++ )<br />
{ <br />
if ( NetResource->dwUsage == RESOURCEUSAGE_CONTAINER && NetResource->dwType == RESOURCETYPE_ANY )<br />
{<br />
if ( NetResource->lpRemoteName )<br />
{<br />
CString strFullName = NetResource->lpRemoteName;<br />
<br />
if ( 0 == strFullName.Left(2).Compare("\\\\") )<br />
strFullName = strFullName.Right(strFullName.GetLength()-2);<br />
<br />
gethostname( szHostName, strlen( szHostName ) );<br />
host = gethostbyname(strFullName);<br />
ptr = (struct in_addr *) host->h_addr_list[0];<br />
<br />
int a = ptr->S_un.S_un_b.s_b1;
int b = ptr->S_un.S_un_b.s_b2;
int c = ptr->S_un.S_un_b.s_b3;
int d = ptr->S_un.S_un_b.s_b4;
<br />
strTemp.Format("%s --> %d.%d.%d.%d",strFullName,a,b,c,d);<br />
pList->AddString(strTemp);<br />
}<br />
}<br />
}<br />
delete Buffer;<br />
WNetCloseEnum( hEnum );<br />
}<br />
WSACleanup();
|
|
|
|
|
This is code I've used successfully in the past:
WSADATA wsaData;
DWORD dwResult,
dwCount = 0xffffffff,
dwBufferSize = 16384;
HANDLE hEnum;
LPVOID lpBuffer;
LPNETRESOURCE lpNetResource = NULL;
dwResult = WSAStartup(MAKEWORD(1, 1), &wsaData);
if (0 == dwResult)
{
dwResult = WNetOpenEnum(RESOURCE_CONTEXT, RESOURCETYPE_ANY, NULL, NULL, &hEnum);
if (NO_ERROR == dwResult && NULL != hEnum)
{
lpBuffer = new BYTE[dwBufferSize];
dwResult = WNetEnumResource(hEnum, &dwCount, lpBuffer, &dwBufferSize);
if (NO_ERROR == dwResult && dwCount > 0)
{
lpNetResource = (LPNETRESOURCE) lpBuffer;
while (NULL != lpNetResource)
{
...
lpNetResource++;
}
}
delete [] lpBuffer;
}
dwResult = WSACleanup();
}
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Thanks for the code, but again thesame. I get these errors:
NetSender error LNK2019: unresolved external symbol _WNetEnumResourceA@16 referenced in function "public: void __thiscall CNetSenderDlg::View(void)" (?View@CNetSenderDlg@@QAEXXZ)
NetSender error LNK2019: unresolved external symbol _WNetOpenEnumA@20 referenced in function "public: void __thiscall CNetSenderDlg::View(void)" (?View@CNetSenderDlg@@QAEXXZ)
NetSender fatal error LNK1120: 2 unresolved externals
|
|
|
|