|
|
#1 |
|
Member
Join Date: Sep 02
Location: in e middle of nowhere..
Posts: 40
![]() |
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!!!
|
|
|
|
|
|
#2 |
|
Kitten
Join Date: Aug 01
Location: In a microchip!
Posts: 11,594
![]() ![]() ![]() ![]() ![]() ![]() |
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. |
|
|
|
|
|
#3 |
|
Member
Join Date: Sep 02
Location: in e middle of nowhere..
Posts: 40
![]() |
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.....
|
|
|
|
|
|
#4 |
|
Kitten
Join Date: Aug 01
Location: In a microchip!
Posts: 11,594
![]() ![]() ![]() ![]() ![]() ![]() |
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. |
|
|
|
|
|
#5 |
|
Member
Join Date: Sep 02
Location: in e middle of nowhere..
Posts: 40
![]() |
thanks a lot!!!
i'l try it out tnite.......
|
|
|
|
|
|
#6 |
|
Member
Join Date: Sep 02
Location: in e middle of nowhere..
Posts: 40
![]() |
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....
|
|
|
|
![]() |
|
||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|