To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
MSDN Subscribers: Download the VS 2010 Release Candidate
MSDN Subscribers: Download the VS 2010 Release Candidate
Sell Your Code and Make Money?
Creating your own Tetris game using VB.NET
Article :: Improving Software Economics, Part 4 of 7: Top 10 Principles of Iterative Software Management



Go Back   VBForums > Other Languages > C and C++

Reply Post New Thread
 
Thread Tools Search this Thread Display Modes
Old Sep 10th, 2002, 01:29 AM   #1
hazel
Member
 
Join Date: Sep 02
Location: in e middle of nowhere..
Posts: 40
hazel is an unknown quantity at this point (<10)
Unhappy "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!!!

hazel is offline   Reply With Quote
Old Sep 10th, 2002, 05:45 AM   #2
CornedBee
Kitten
 
CornedBee's Avatar
 
Join Date: Aug 01
Location: In a microchip!
Posts: 11,594
CornedBee is a glorious beacon of light (400+)CornedBee is a glorious beacon of light (400+)CornedBee is a glorious beacon of light (400+)CornedBee is a glorious beacon of light (400+)CornedBee is a glorious beacon of light (400+)CornedBee is a glorious beacon of light (400+)
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.
CornedBee is offline   Reply With Quote
Old Sep 10th, 2002, 11:42 AM   #3
hazel
Member
 
Join Date: Sep 02
Location: in e middle of nowhere..
Posts: 40
hazel is an unknown quantity at this point (<10)
Talking

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.....

hazel is offline   Reply With Quote
Old Sep 11th, 2002, 04:13 AM   #4
CornedBee
Kitten
 
CornedBee's Avatar
 
Join Date: Aug 01
Location: In a microchip!
Posts: 11,594
CornedBee is a glorious beacon of light (400+)CornedBee is a glorious beacon of light (400+)CornedBee is a glorious beacon of light (400+)CornedBee is a glorious beacon of light (400+)CornedBee is a glorious beacon of light (400+)CornedBee is a glorious beacon of light (400+)
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.
CornedBee is offline   Reply With Quote
Old Sep 11th, 2002, 06:58 AM   #5
hazel
Member
 
Join Date: Sep 02
Location: in e middle of nowhere..
Posts: 40
hazel is an unknown quantity at this point (<10)
thanks a lot!!!
i'l try it out tnite.......
hazel is offline   Reply With Quote
Old Sep 12th, 2002, 03:50 AM   #6
hazel
Member
 
Join Date: Sep 02
Location: in e middle of nowhere..
Posts: 40
hazel is an unknown quantity at this point (<10)
Lightbulb

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....

hazel is offline   Reply With Quote
Reply

Go Back   VBForums > Other Languages > C and C++


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 08:24 AM.




To view more projects, click here

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.