Reading contents CHttpFile file starting from the end of file.

I have a CHttpFile which contains records per day. The records in the file 
are ordered date descending.  I need to have my records with date ascending.  
So, if I read the file starting with last record back up to first record I'll 
get my data sorted correctly.  There is a huge amount of data, that's why I 
want to read the data in the correct order instead of reading it, placing in 
memory and then sorting.  I'm using CHttpFile.ReadString to read the contents 
right now but it read from the top.  Is there any way for me search through 
the contents of the file of a '\n' and position my cursor right after it? 
This way it will be ready to read the next record.  I'm new to C++, so 
forgive any silliness in my question.  The file is comma seperated with \n at 
the end of each record.
0
Sheeba (1)
2/9/2006 9:12:29 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
698 Views

Similar Articles

[PageSpeed] 18

I am not sure if that is such a good idea.  I am assuming that you now the
size of each record and that they are constant.
If you do then, when the enter file is downloaded then you can call the
SeekToEnd and Seek methods to move up the file.

Assuming that when you read the data you are storing or displaying them in a
list of some sort
But the way I would tackle this problem is that I would read from the top of
the file and insert into the storage area.  Each new line that I read will
be inserted right before the last item (using InsertAt or Insert methods of
the storage). At the end you will have the data from new to old.

AliR.


"Sheeba" <Sheeba@discussions.microsoft.com> wrote in message
news:114B085B-DCCC-45B3-9956-93AA225EB0A2@microsoft.com...
> I have a CHttpFile which contains records per day. The records in the file
> are ordered date descending.  I need to have my records with date
ascending.
> So, if I read the file starting with last record back up to first record
I'll
> get my data sorted correctly.  There is a huge amount of data, that's why
I
> want to read the data in the correct order instead of reading it, placing
in
> memory and then sorting.  I'm using CHttpFile.ReadString to read the
contents
> right now but it read from the top.  Is there any way for me search
through
> the contents of the file of a '\n' and position my cursor right after it?
> This way it will be ready to read the next record.  I'm new to C++, so
> forgive any silliness in my question.  The file is comma seperated with \n
at
> the end of each record.


0
AliR3470 (3235)
2/9/2006 9:27:45 PM
Use list STL with the push_front(...)

-- 
Vipin Aravind

"Sheeba" <Sheeba@discussions.microsoft.com> wrote in message 
news:114B085B-DCCC-45B3-9956-93AA225EB0A2@microsoft.com...
>I have a CHttpFile which contains records per day. The records in the file
> are ordered date descending.  I need to have my records with date 
> ascending.
> So, if I read the file starting with last record back up to first record 
> I'll
> get my data sorted correctly.  There is a huge amount of data, that's why 
> I
> want to read the data in the correct order instead of reading it, placing 
> in
> memory and then sorting.  I'm using CHttpFile.ReadString to read the 
> contents
> right now but it read from the top.  Is there any way for me search 
> through
> the contents of the file of a '\n' and position my cursor right after it?
> This way it will be ready to read the next record.  I'm new to C++, so
> forgive any silliness in my question.  The file is comma seperated with \n 
> at
> the end of each record. 


0
vipin (697)
2/10/2006 4:18:06 AM
Reply:

Similar Artilces:

Reading .wks file
Greetings...according to the Excel "help" file, as well as the file extension listing, I *should* be able to read an *.wks file, but Excel insists that it cannot. I am pretty sure the file was created in Microsoft Works. Is there a converter somewhere that I can download/install? Cheers - S2 Excel can read Works 2.0, not later. You have to save them in Works as excel files or Works 2.0 or get a commercial converter. -- Regards, Peo Sjoblom "Skip Stocks" <anonymous@discussions.microsoft.com> wrote in message news:AFC110E0-641D-4D87-9464-B930CC41CF02@microsoft....

Inserting text from a .txt file
I'm trying really hard to jump on the bandwagon and migrate from Outlook Express to Outlook, but the more I try, the more frustrated I get. Anyway, here is my question: How do I insert the text from a text file into my e-mail document. I am using the rtf editor. thank you, ~alan copy/paste? "~~Alan~~" <alan.shepro_NOSPAM@verizon.net> wrote in message news:%23%23AwZrIKEHA.1264@TK2MSFTNGP12.phx.gbl... > I'm trying really hard to jump on the bandwagon and migrate from Outlook > Express to Outlook, but the more I try, the more frustrated I get. > > Anywa...

Clear Contents except first character
I have an excel spreadsheet which contains answers to a survey (man rows of columns of answers, each column is the answer to a question) Each cell in each column contains one of the following answers; 1- Yes 2- Not Really 3- Always 4- Never *I would like to clear the contents of all the cells so that the onl thing that appears is the number, not the additional words. Th numbers are in the first character space of each cell. * For example if cell B3 says �1- Yes� I want cell B3 to just have �1� I know how to do this manually, but I know there has got to be a way t automate this b/c it is a ...

xml config file...
hello, I ve a Windowsapplication with a configuration file app.config... (it's in xml) code app.config: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name = "MyNameValueSection" type="System.Configuration.NameValueSectionHandler" /> </configSections> <MyNameValueSection> <add key="MyKey" value="MyValue" /> </MyNameValueSection> <appSettings> <add key="test" value="MeinInhalt" /> </appSettings> </configurati...

How to give other users read-only access to Calendar
I want to allow the group Everyone to have read-only access to a calendar in a certain mailbox. I can do this by granting the permission 'Full mailbox access' (under 'Mailbox rights', under 'Exchange Advanced', for the particular user). However this also allows people to to do everything (ie: they become read-write users). I notice that every mailbox in the system has 'Read permissions' granted to group Everyone. This does not allow other people to open items in the mailbox, but as I understand it, permits Exchange Server and Outlook to do shared meetin...

Delete oldest file first
All, I am looking for some code that deletes the oldest files first in a directory. Any help would be great. Thanks in advance. "karibbean" <sharp_mind@REMOVE.this.email.msn.dotcom> wrote in message news:uJZArpxvFHA.2132@TK2MSFTNGP15.phx.gbl... > I am looking for some code that deletes the oldest files first in a > directory. Any help would be great. Thanks in advance. See FindFirstFile, FindNextFile, FindClose, DeleteFile -- With best wishes, Igor Tandetnik With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is ...

Make excel 2003 default to open files
I have Excel 2003 running alongside 2007. Double clicking an excel file causes it to open in 2007; how do I force 2003 to open the files instead? Sandy You most likely have to reset your file association from 2007 to 2003. Close Excel first and On the Windows Taskbar 1) Start>Run "excel.exe /unregserver"(no quotes)>OK. 2) Start>Run "excel.exe /regserver"(no quotes)>OK. See the space between exe and /regserver You might have to designate a full path to excel.exe for Office 2003 In that case Start>Run "C:\your path to\office11\excel.exe" ...

Read mail arn't marked as read anymore
After an SP upgrade of my Office 2000 the priviewed mail doesnt get marked as read anymore. I have tried to change the time (Tools->Options->Priview pane) from 2 -> 3 -> 4 seconds but nothing works. The only way to mark a mail as read is either to open it or right click it and chose Mark as read. Since I only use the priview pane this is very anoying for me. Is this a bug or has some setting changed with the SP? ...

Altering the contents of a rounded square
In Visio 2007 I created a rounded square and inserted an * into it. How can I center the * in the current shape of the rounded square? Thanks for looking. -- Cheers, John If you entered it as text, then change the vertical alignment of the text and the horizontal alignment to be middle. John... Visio MVP Need stencils or ideas? http://visio.mvps.org/3rdparty.htm Need VBA examples? http://visio.mvps.org/VBA.htm Visio Wishlist http://visio.mvps.org/wish_list.htm "happydude" <happydude@discussions.microsoft.com> wrote in message news:86F99087-77AE-4CAB-B2BC-732D...

scrambled excel file
Hi AGAIN. I'm trying to open a file that was deleted and later retrieved through GetData Back. It has an .xls extension, but when I try to open it, it's just symbols. Is there some way I can retrieve the proper info. from that file? Do I have to save it as something else? I really need this file back - l mean life & death!! I will attach the file to see if someone can figure this out for me. Thanks again for your help. Your advice last time was great. Sandy Attachment filename: wolf_info liz.xls Download attachment: http://www.excelforum.com/attachment.ph...

Import txt file into excel with 281,344 rows
Hi, I've got a very large txt file that I need to import into excel. It has 288,344 rows. Is there a way I can do this? The fields on my txt file are separated by a pipe "|" Thanks in advance. If you're using xl2007, then that data will fit. Open the .txt file and choose delimited by | If you're using xl2003 and below, you could use your favorite text editor to make several smaller .txt files (65536 rows or smaller) and import each into separate worksheets. JulieM39 wrote: > > Hi, I've got a very large txt file that I need to impo...

error attaching file to email
Getting the error: File Upload Failure There was a problem while attempting to upload the requested file. Check the path and try again. The file is a pdf, about 74 KB. Any ideas?? ...

front-end or back-end
Hi, What is the use of front-end (FE) and back-end (BE) in Access? I work on a server, where I store the database. This allows me of course of changing my forms, queries , reports or modules only in one place. Is there any advantage in using tfe FE/BE approach in Access? Are there any good books about this approach ? Thanks, W if you are single user than there is no need to split if it is multi user then one splits fe/be so that all can work simultaneously on separate fes one can modify one fe without kicking off other users from their fe...... -- NTC "W" wrote: > Hi, ...

Weird files
Just noticed I've got a ton of weird files with names like 2BE48300. The normal files seem to be ok. Any idea what might be producing all these extra files? -- For a list of all the ways technology has failed to improve the quality of life, please press three. ....Alice Kahn Not sure. Perhaps cleaning up your hard drive will help. http://www.officearticles.com/misc/how_to_clean_up_your_hard_drive.htm Are they Excel files? **************************** Hope it helps! Anne Troy www.OfficeArticles.com **************************** "Steve" <teu@qprc.inv> wrote in message...

"File access denied" to PST file
I have gone from Windows 2000 running Outlook 2000 to Windows XP Pro running Outlook 2003. When I try opening my saved .pst file in the new Outlook I get a message saying "File access denied. You do not have permission required to access to file mailbox.pst" I am logged on as Administrator, as I was on the old install. How do I open my saved mailbox.pst or archive.pst? TIA How did you try opening it? is this a local .pst file? If it is not on your C: drive, is it marked Read-Only? --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion int...

File won't open as read only
I have a file that is in use, but another person opens it and it doeasn't display the "file is in use" message. Is there a setting or fix? Hi have you shared this file? -- Regards Frank Kabel Frankfurt, Germany John wrote: > I have a file that is in use, but another person opens it > and it doeasn't display the "file is in use" message. Is > there a setting or fix? The file is on a network share. The share has all the appropriate permissions. >-----Original Message----- >Hi >have you shared this file? > >-- >Regards >Frank Ka...

path of .pst file
Hello everyone, I want to develop a stand alone application to send and recieve mails through MS Outlook.how can i retrieve the path of .pst file from .net application. actually i am thinking of reading the pst file of MS Outlook. is it possible? Thanks in Advance jyoti The pst file is stored in the profile path of the MSOUTLOK Since the path of the pst can be varied by the user, as can its name, ie it neednt be in the install default path, your app would first have to search for the pst, then you would have to figure out if it/which was the current pst. There are alleged to be third ...

reading confirmation
Good day, I have a problem with outlook. When they send a message to me that demands the shipment of a reading confirmation, even if I accept, the reading confirmation does not come received from the sender. Someone knows from what depends and in which way I can resolve the problem? Thanks for the eventual answers. Niki In news:eht7fo$251$1@fata.cs.interbusiness.it, Niki <nicola.pantaleo@yahoo.it> typed: > Good day, > > I have a problem with outlook. When they send a message to me that > demands the shipment of a reading confirmation, even if I accept, the > read...

Number format using formula or cell content
Is it possible to use a formula or the content of another cell to set the number of decimal places? For example, if cell A1 had a formula which results in the value 4, I want cell C6 to show 0.0000 and if A1's value was 7 I want C6 to show 0.0000000. Thanks.... Hi not possible with a format. You'll have to use VBA -- Regards Frank Kabel Frankfurt, Germany "mike hutchins" <ma_hutchins@hotmail.com> schrieb im Newsbeitrag news:ccdd7764.0409240642.3e6bb7d0@posting.google.com... > Is it possible to use a formula or the content of another cell to set > the number of ...

can't open pub2000 file in pub2002
I have a bunch of Publisher 2000 files created by someone else on a different computer. I'm trying to open them in Publisher 2002 on my Windows ME computer. Most of them open but two will not. I do have Norton AntiVirus, I have already disabled script blocking and disabled the Microsoft Office Plug-In. I installed the patch for blocking the conversion of Wordart. The two files are 39MB and 44MB, but I've opened a file that was 80MB without trouble (well, it took a long time, but it opened). Can you help? Try opening them in safe mode. If they open, rename them, could be the ...

Retrieve Exchange 2007 public folder content
I have Exchange 2007 and a public folder containing mainly Tasks. i need to obtain a collection of this tasks from c# to send an alert by email on the ending of the task schedule (i cannot use the integrated task ending in the public folder). My problem is, how can i query the exchange store to obtain this informations? Do i have to use the OUTLOOK MAPI CLIENT library or the web service of exchange 2007? Can you give me an example? Thank you. Hello Cato, > I have Exchange 2007 and a public folder containing mainly Tasks. i > need to obtain a collection of this tasks f...

"Unblock" feature should be optional when reading e-mail in CRM
When viewing e-mail messages in CRM, a line appears saying "Unblock" to allow the full message content to be read. Can this be made a configurable server or security setting? We are trying to reduce "clicks" as much as possible. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agre...

copy contents including colour
Hi In cells A1:B73 I have a list of contacts which are colour coded. What I want to be able to do is to be able to enter the name of 1 of the contacts in lets say G1 and it will search for that name in A1:B73 and automatically copy its colour code over. Many thanks for any help. Al Hi, I'm assuming that the colour codeing isn't a result of conditional formatting and it's simply a fill colour. To do this you need VB. Alt+F11 to open vb editor. Double click the worksheet that this data are on and paste the code in on the right. Close VB editor and type your name...

Cannot delete xml file - file based event scheduling
Hi, I have a report scheduled with File based event scheduling in CR XI Server version 11.5. The report is created with XML file as its datasource. The report will be triggered if the event of xml file is created in the source directory. As per the schedule, it will look for the event to occur every 1 minute. Since I need to enerate this report everytime the file comes into the directory, I have to delete the file after he report is generated, so that, next time the file comes in, the report will be generated again. After the report is run for the first time successfuly as the event occurs...

Previously used file option GONE? help please
Win98SE 'Office XP Pro' In Excel I am unable to find how to enable "open previosly used files" or words to that effect. I have checked in "options" but cannot see it there. When I used it previouly I was able to select the number of files last used, which would be available for me to select when starting EXCEL. TIA Hi do you mean the option in the 'File' menu (at the bottom)? -- Regards Frank Kabel Frankfurt, Germany Terry wrote: > Win98SE > 'Office XP Pro' > > In Excel I am unable to find how to enable "open previosly used...