|
OK, now I see.
For this to work correctly, you must be certain that each customer is layed out the same. IE, if you have yet to create a cost, within the text file you should place 0 and not an empty line.
For the struct, I would do something like
struct CUSTOMER<br />
{<br />
DWORD QuoteNumber;<br />
CHAR Surname[56];<br />
CHAR Initials[2];<br />
DWORD CarpetCost;
DWORD DeliveryCost;<br />
SHORT Guarantee;
}
Now since the file is layed out with 5 lines per customer, I would create a function to read a single customer then call this in a loop until there are non remaining.
bool ReadCustomerDetails( FILE* hFile, CUSTOMER* pCustomer )
Open the file with fopen(), read each line with gets() then depending on the which line you read convert it to the datatype in the struct.
Have a go at coding that, need any help just say the word.
|
|
|
|
|
WalderMort wrote: Now since the file is layed out with 5 lines per customer, I would create a function to read a single customer then call this in a loop until there are non remaining.
bool ReadCustomerDetails( FILE* hFile, CUSTOMER* pCustomer )
Open the file with fopen(), read each line with gets() then depending on the which line you read convert it to the datatype in the struct.
Your struct is good, but I would opt for reading/writing it as binary instead so that one fread() could be used per record, rather than multiple fgets() calls.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
If I were to code something like this myself, I probably would. But given that the OP comes across as a bit of a newbie I don't want to confuse him too much
|
|
|
|
|
Thanks, its making some sence now...
I was confused with this part as in specs it was written that file would be loaded to array of structurs in order that new records can be appended and the records can be viewed on screen. So i guess its just to create a struct with all the fields which are included in text..and then text is just called and saved...
I have started coding for it. Would ask you if i face any further problems..
Thanks a lot..
|
|
|
|
|
Why on earth use a Text File for this! If it HAS to be a Text File, I would add a Sync Key at the start of each record. (This is Line of Text such as:"$$$***&&&?//??**<<>>"). You scan this line at the start of each record, and compare it with your Hardcoded String. If it does not compare, you're out of sync. This means that you are alerted to something being wrong, and you have atleast some hope of recovery.
The way I would approach this would be to store the structures directly in the file as binary. Keep in mind that what starts now as small data, will in time grow into a huge record. Searching in a Huge textfile ends up time consuming. Weeding out redundant records can be problematic.
LateNightsInNewry
|
|
|
|
|
how can i display the thumbnail preview of the images on the view?
Regards,
Srinivas
|
|
|
|
|
You dont need to ask a same question
|
|
|
|
|
Do you know what a thumbnal IS? If so, then you should also know that displaying a mini-version
of a bitmap image is done the same way as displaying the big one, right?
Great job, team. Head back to base for debriefing and cocktails.
|
|
|
|
|
I am using Visual Studio 6.0. VS resource editor does not support unicode. So when I write some polish characters in string table or dialog controller "??" values are shown. How should I make a resource file/ resource dll for Polish language?
Thanks in advance.
|
|
|
|
|
See my answers in this thread[^].
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
how can i display the thumbnail preview of the images on the view?
Regards,
Srinivas
|
|
|
|
|
Where do you want to show this preview main dialog or other dialog?
|
|
|
|
|
i taken one SDI Applacation ..
and i want to show the preview of images on the view(like bmp , png ..ect) ...
view means (CView,or TreeView)
Regards,
Srinivas
|
|
|
|
|
You can use of CImage or GDI+ for show these formats.
and if you want to thumbnail of all images I suggest use of CListCtrl
|
|
|
|
|
how can i add the Media player control on List view?
Regards,
Srinivas
|
|
|
|
|
Can you clear explain,do you want to show movie files?
|
|
|
|
|
Hey Guys,
This might sound like a silly question but does Visual C++ 6 run on Windows Vista? May faithful Win2K laptop is starting to die and I need a replacement and it looks as though I might be stuck with Windows Vista.
Best regards
Danny
|
|
|
|
|
Yes, I know it does. But, why would you stick with such a bad C++ compiler ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I agree that MSVC6 sucks but not everyone can upgrade on a whim. We still use MSVC6 where I work and will only upgrade when the "powers that be" decide. I'm not holding my breath.
Steve
|
|
|
|
|
what is so bad about VC6? is this something that only a "heavy duty" coder would notice, or is it something that even a quick and nasty dialog programmer would want to think about? What would be a better option?
|
|
|
|
|
VC7, VC7.1 or VC8. VC6 is very non conformant to the standard and the STL implimentation is plain terrible.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
VC 6 works fine on Vista, I use it daily.
|
|
|
|
|
Same here, works fine (although I have not used VC6 for anything really complex on Vista).
|
|
|
|
|
moving a cursor automatically by pixel value which has been specified
hi hih hi ihh
|
|
|
|
|
In other words,
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|