|
-
Sep 10th, 2002, 12:29 AM
#1
Thread Starter
Member
"new line break in readin' from file"
hello there!!
when i read from txt file and display out in the multiline edit box, they all read the new line break as "|", one dark stroke...
i'm wondering how i can get rid of this,,,,
i'm using MFC Dialog boxes,,,,,, btw.....
and also,, doez anybody know what's the use of Tab control that we all c on the toolbar????
dunno how to place items on it,,,, =~(
thanks a lot!!!
-
Sep 10th, 2002, 04:45 AM
#2
Do you use MFC's CStdioFile class to read the file? With type set to CFile::modeText ?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 10th, 2002, 10:42 AM
#3
Thread Starter
Member
huh?? how??
hee i juz used the codes i use for writing C programs...
fread,, fopen,, all those,,,,,,,
can explain to me how to use that???
n some sample codes pls,,, hehe..... =)
thank u.....
-
Sep 11th, 2002, 03:13 AM
#4
CStdioFile is just a wrapper around those.
Since you're reading a text file, you don't want the binary fread and fwrite, but rather the text io fgets, fputs, fprintf and fscanf.
Open the file with
fopen(filename, "?t");
where ? is the access you want (r,a,w,r+,a+,w+).
Then you can use the 4 functions, look them up in the reference.
The C++ file streams can handle text files too. Don't pass the ios_base::binary flag to open and you'll be fine.
Windows files can't handle text files correctly - they will not convert \r\n to \n. Neither does MFC CFile, which is just a wrapper around windows files.
This is why there is the CStdioFile class. Derived from CFile, this class doesn't use windows files but rather C files. You can pass CFile::modeText to Open in order to open a file in text mode. Then you can call ReadString or WriteString for i/o.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 11th, 2002, 05:58 AM
#5
Thread Starter
Member
thanks a lot!!!
i'l try it out tnite.......
-
Sep 12th, 2002, 02:50 AM
#6
Thread Starter
Member
hi.. thanks...now i can read from text file and display out nicely..
but .. if i just want t scan part of it by passing the parameters, how can i do it???
this is how my program is like..
i choose from the list box, and according to the choice,, i want t display the respective information in the edit box....which will be read from txt file...
so i need to pass some info so tat it can go and retrieve the correct part of txt file.....
and now i hav 2 txt file,, 1 is for the list of choices i mentioned above for the list box,, and e other for e details....
if i want t combine these 2 and retrieve accordingly, how shal i code it??
thanks a lot....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|