|
You can try fgets which is C function
look the sample code snippet
FILE *fp = fopen("c:\\file.txt","r");
char ar[100];
while(fgets(ar,100,fp))
{
print (ar);
}
fclose(fp);
If u can Dream... U can do it
|
|
|
|
|
And if you are using MFC, there's CStdioFile::ReadString() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I think this will work CStdioFile::ReadString
|
|
|
|
|
Can you be more specific Its a minimum info
|
|
|
|
|
yeah WhiteSky..I am developing a dialog based MFC application, in which i want to read a text file line by line for parsing and identifying certain charaters such as (), *. % etc. So i wanted to read the text file line by line to count occurance of each keyword at each line. Hope this information is sufficient.
|
|
|
|
|
well you can use of David answer CStdioFile::ReadString or CFile::Read
|
|
|
|
|
thanks very much...but i think CFile::Read reads the specified number of characters at one go. How do we know the size of each line well in advance. Is there any function in CFile that facilitates it?
|
|
|
|
|
vikram.vit wrote: How do we know the size of each line well in advance.
You don't (at least not without a lot of unnecessary code). That's why I suggested CStdioFile::ReadString() and not CFile::Read() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi All
In my application "unexpected end of file found" errors is occurd. If anybody know the solution plz send me.
Ragards
Atool
Atool
|
|
|
|
|
See in your project setting --> C/C++ -->Precompile headers -->Create/Use precompiled header option. If its /Yu , include file mentioned in Create/Use PCH Through File option(usually stdafx.h ) as first include file your(in fact it should be first statement ) cpp file.
|
|
|
|
|
M. Atul wrote: In my application "unexpected end of file found" errors is occurd.
When? During compilation, or at run-time?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
This usually occurs in my programs because I forgot to "#include "stdafx.h" in my class's .cpp file
A C++ programming language novice, but striving to learn
|
|
|
|
|
If I make changes to the registry (these changes will effect Win95), how
can I make Win95 update and refresh the registry, and thus make the
changes to windows95?
How can get the string value(sub key like string value, DWORD value, Binary value, etc.) from registry?
For example if my app sets the flag for a registry key, via the registry, how can I make windows95 refresh the registry and make the change?
Im using VC++ 6.0.
Enjoy Life........
|
|
|
|
|
what you mean by refreshing registry ? and what exactly are u setting ?
If u can Dream... U can do it
|
|
|
|
|
Poonamol wrote: If I make changes to the registry (these changes will effect Win95), how
can I make Win95 update and refresh the registry...
By using the registry API (e.g., RegOpenKeyEx() , RegCreateKeyEx() , RegQueryValueEx() ).
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello all,
I have one Edit Control IDC_PATH , and some path in (LPARAM)szDir variable.
Now I want to set the value of szDir in the IDC_PATH edit box , how to do this ?? Please can anyone tell me hw to do this .
<br />
SendDlgItemMessage(hwnd,IDC_PATH,(LPARAM)szDir,0,0);
I tried with this code its not working. What will be the error ?
Edit/Delete Message
And also I want to know how to disable and enable edit box ???
Thanking you,
Suresh HC.
|
|
|
|
|
Suresh H wrote: SendDlgItemMessage(hwnd,IDC_PATH,(LPARAM)szDir,0,0);
SetDlgItemText(IDC_PATH,szDir);
should do
hth
Jetli
Constant Thing In World Is Change.
|
|
|
|
|
Hi Jetli,
Thanks for the responce. I tryed with that code i am getting error
<br />
SetDlgItemText(IDC_PATH,szDir);
error C2660: 'SetDlgItemTextA' : function does not take 2 parameters
Error executing cl.exe.
|
|
|
|
|
Which type is your application ? if it is a MFC dialg based app the paramter to SetDlgItemText is correct , otherwise u need to provide the HWND of your dialog in SetDlgItemText function.
SetDlgItemText(<dilogs handle="" hwnd=""> , IDC_PATH, szDir);
Refer MSDN.
If u can Dream... U can do it
|
|
|
|
|
Hi krishna,
I am using Win 32 Application.
|
|
|
|
|
So where you placed the edit control ? dialog or window ?
and which function you using for showing dialog(DialogBox() ) ? you will get the hwnd of dialog in dialog Proc.
if it is dialog put your dialogs handle in SetDlgItemText
Hopes this helps
If u can Dream... U can do it
|
|
|
|
|
Suresh H wrote: SendDlgItemMessage(hwnd,IDC_PATH,(LPARAM)szDir,0,0);
You passing wrong value as third parameter, it should be message to send(WM_SETTEXT in this case).
Modify your code to,
SendDlgItemMessage(hwnd,IDC_PATH,WM_SETTEXT,0,(LPARAM)szDir);
You can use SetDlgItemText either.
|
|
|
|
|
Hi Prasad,
Its working thank you very much.
|
|
|
|
|
Most welcome !
Actually , I overseen your second question. But CPallini has answered that.
|
|
|
|