why the content is NULL that I read file??

to ALL:
void GetOfforLenth(CFile &file, const CString *str, int index,LONG
&offset,LONG &lenth)
{
 int nstart,nend;
 CString pfile;
 file.Read(&pfile,file.GetLength());
///why the pfile is null
 offset=nstart=pfile.Find(str[index]);
 nend=pfile.Find(str[index+1]);
 pfile=pfile.Mid(nstart,nend-nstart);
 lenth=pfile.GetLength();
}

it is appreciated for anyone reply


0
terrcy (22)
4/29/2004 5:16:12 AM
vc.mfc 33608 articles. 0 followers. Follow

5 Replies
567 Views

Similar Articles

[PageSpeed] 43

hi,
   Shldnt the code be something like this ?
CString pFile = *str;
You never seemed to set the value to the pFile.
hth
gangadhar

terrcy wrote:

> to ALL:
> void GetOfforLenth(CFile &file, const CString *str, int index,LONG
> &offset,LONG &lenth)
> {
>  int nstart,nend;
>  CString pfile;
>  file.Read(&pfile,file.GetLength());
> ///why the pfile is null
>  offset=nstart=pfile.Find(str[index]);
>  nend=pfile.Find(str[index+1]);
>  pfile=pfile.Mid(nstart,nend-nstart);
>  lenth=pfile.GetLength();
> }
> 
> it is appreciated for anyone reply
> 
> 
0
4/28/2004 5:25:42 PM
no,I want to read the file into the pFile.
and pfile will stock the content.
so I pass the param using refer of pfile!
"gangadhar npk" <gangadhar_npk_@nospam.plz> wrote in message
news:#Gw9ypaLEHA.3892@TK2MSFTNGP11.phx.gbl...
> hi,
>    Shldnt the code be something like this ?
> CString pFile = *str;
> You never seemed to set the value to the pFile.
> hth
> gangadhar
>
> terrcy wrote:
>
> > to ALL:
> > void GetOfforLenth(CFile &file, const CString *str, int index,LONG
> > &offset,LONG &lenth)
> > {
> >  int nstart,nend;
> >  CString pfile;
> >  file.Read(&pfile,file.GetLength());
> > ///why the pfile is null
> >  offset=nstart=pfile.Find(str[index]);
> >  nend=pfile.Find(str[index+1]);
> >  pfile=pfile.Mid(nstart,nend-nstart);
> >  lenth=pfile.GetLength();
> > }
> >
> > it is appreciated for anyone reply
> >
> >


0
terrcy (22)
4/29/2004 5:32:20 AM
I think you have to use pfile.GetBuffer(file.GetLength()) in place of &pfile
and call pfile.ReleaseBuffer();

Arun

"terrcy" <terrcy@cn-finet.com> wrote in message
news:uh3nrtaLEHA.1264@TK2MSFTNGP12.phx.gbl...
> no,I want to read the file into the pFile.
> and pfile will stock the content.
> so I pass the param using refer of pfile!
> "gangadhar npk" <gangadhar_npk_@nospam.plz> wrote in message
> news:#Gw9ypaLEHA.3892@TK2MSFTNGP11.phx.gbl...
> > hi,
> >    Shldnt the code be something like this ?
> > CString pFile = *str;
> > You never seemed to set the value to the pFile.
> > hth
> > gangadhar
> >
> > terrcy wrote:
> >
> > > to ALL:
> > > void GetOfforLenth(CFile &file, const CString *str, int index,LONG
> > > &offset,LONG &lenth)
> > > {
> > >  int nstart,nend;
> > >  CString pfile;
> > >  file.Read(&pfile,file.GetLength());
> > > ///why the pfile is null
> > >  offset=nstart=pfile.Find(str[index]);
> > >  nend=pfile.Find(str[index+1]);
> > >  pfile=pfile.Mid(nstart,nend-nstart);
> > >  lenth=pfile.GetLength();
> > > }
> > >
> > > it is appreciated for anyone reply
> > >
> > >
>
>


0
arun777 (2)
4/29/2004 7:31:02 AM
here!I want to write the file(.txt) to other file(other .txt),
but the content is different of these two file.
why?

void CMainFrame::GetOfforLenth(CFile &file, const CString *str, int
index,LONG &offset,LONG &lenth)
{

 WCHAR *pzcTemp = new WCHAR[file.GetLength()+1];
    CString pfile;
    file.Read(pzcTemp,file.GetLength());
 pfile = pzcTemp;

 CFile test;

test.Open("D:\\test.txt",CFile::modeCreate|CFile::modeReadWrite|CFile::typeB
inary);
 test.Write(&pfile,pfile.GetLength());
 test.Close();

}


0
terrcy (22)
4/29/2004 10:06:38 AM
Hope this helps

 CString pfile;
 CFile file;
 file.Open ("c:\\t.txt", CFile::modeRead ,NULL);
 int size=file.GetLength();
 WCHAR  *pzcTemp = new WCHAR[size+1];
 memset(pzcTemp,0,size*2+1);//since WCHAR
 file.Read(pzcTemp,size);
 file.Close ();
 CFile test;
 pfile = pzcTemp;

test.Open("D:\\test.txt",CFile::modeCreate|CFile::modeReadWrite|CFile::typeB
inary);
 test.Write(pfile.GetBuffer (0),size);
 test.Close();

"terrcy" <terrcy@cn-finet.com> wrote in message
news:OcoR9GdLEHA.2704@TK2MSFTNGP10.phx.gbl...
>
> here!I want to write the file(.txt) to other file(other .txt),
> but the content is different of these two file.
> why?
>
> void CMainFrame::GetOfforLenth(CFile &file, const CString *str, int
> index,LONG &offset,LONG &lenth)
> {
>
>  WCHAR *pzcTemp = new WCHAR[file.GetLength()+1];
>     CString pfile;
>     file.Read(pzcTemp,file.GetLength());
>  pfile = pzcTemp;
>
>  CFile test;
>
>
test.Open("D:\\test.txt",CFile::modeCreate|CFile::modeReadWrite|CFile::typeB
> inary);
>  test.Write(&pfile,pfile.GetLength());
>  test.Close();
>
> }
>
>


0
arun777 (2)
4/29/2004 11:31:18 AM
Reply:

Similar Artilces:

Move .pst File to New Location #2
If I move the .pst file to a new directory location , how do I get Outlook to find it? Is there a way to move the .pst without disabling all the message rules? The reason I ask is because I like to share .pst files between my laptop and desktop. The prob is the message rules use fully qualified path and file locations. My laptop has a business name user and therefore a different file location. So the two cannot share the message rules. I want to move the .pst file to something like C:\My Documents\OutlookData..., something thats the same for both pcs. Thanks, -Bob Outlook 2003 Dea...

Title in Content Control disappears when grouping?
Hi, If I GROUP a portion of my document where there is a CONTENT CONTROL, its TITLE is not visible anymore. Why? I would like to avoid the user changing parts of my document, but still giving him the best clues where and what to type. thanks, Lauro When I looked at this a. I saw the same as you; b. I did not find a workaround. Non-response suggests none of the regular responders who are around knows either. > Why? You'd have to ask Microsoft (most if not all of the people here are volunteers, not their employees). It looks as if...

open a non-office file using cell data from excel
can I open a non-office file using cell data from excel. I want to use data calculated within excel, which I have then put into a string, to then be used to open the file, to which that string refers. Have a look in vba help for SHELL -- Don Guillett SalesAid Software dguillett1@austin.rr.com "dcauldwell" <dcauldwell@discussions.microsoft.com> wrote in message news:88B01B4E-7CFD-455D-B4AC-FD7E000F8B66@microsoft.com... > can I open a non-office file using cell data from excel. > I want to use data calculated within excel, which I have then put into a > string, to t...

table of content
Using styles (Heading 1, etc) in Word (any version) allows me to create a TOC very simply. I cannot find a way to create a table of content automatically in Publisher (2003), for instance by applying styles. Am I missing something or have they just left out this option? Don't want to create a TOC manually in a 200 page document.... TIA - Rob The bad news is you will have to create the TOC manually. Publisher is a page layout application. Word is better suited for what you are doing. -- Mary Sauer MS MVP http://office.microsoft.com/ http://www.mvps.org/msauer/ news://msnews.microsof...

Problem Exporting Calendar contents with custom fields
I have created a customized form in MS Outlook Calendar to create appointments with more data that I need to track. When exporting a calendar to a CSV file, outlook only recognizes the main appointment fields, not my custom fields to export. I would like to see me fields export with the calendar. Any ideas? Thanks, Kris ...

Accessing an OST file
I have a user that is looking for a long lost email that she "hopes" she saved. Of course, she has many, many PST files. The email is not in any of those. There are 3 OST files in the default Outlook folder on her computer. Is there a way to open and search those files? I've done some research and have read that if the OST is orphaned, then you need to buy software that will let you convert the OST to a PST. That doesn't seem to be the case here, it is in her windows folder. Thanks "JohnB" <jbrigan@yahoo.com> wrote in message news:...

keep formula delete contents
I'm trying to set up a template in Excel. I wish to keep the formula but delete contents, so i can us the same sheet again. Every formula evaluates to something -- a string, a number, an error, ... So you can't really delete the contents and still keep the formula. But you could modify the formula so that it returns an empty string ("") and that makes the cell look empty. You could modify the formula to look at the other cells it needs and if those are empty, then return that "" string. For example, if I had a formula that just added 12 to the valu...

Can't open my Access files after conversion from Access 97 to Access 2003
Hi, After I converted my MS Access files from ver 97 to 2003, I cannot open them anymore. How can I resolve this problem? I run Windows XP Pro SP 3. Regards M Shafaat It isn't clear what's happening when you try ... more information, please. Are you attempting to open them with Access '97 or with Access 2003? Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereo...

Navigation Bars
I put Navigation bars on my publisher website document. When I try to publish to a file or to the web, the Navigation Bars do not appear on the page(s). How do I resolve this?? Answer found in the web group. DavidF "Tom Snyder" <Tom Snyder@discussions.microsoft.com> wrote in message news:7A55B689-FE9D-4E1E-9B6C-3ED571156D46@microsoft.com... >I put Navigation bars on my publisher website document. When I try to >publish > to a file or to the web, the Navigation Bars do not appear on the page(s). > How do I resolve this?? Tony, did you get an answer to this...

CSV files
I try to open .CSV files from excel but they open in a single column. Help Tks, Gaby This can happen if the windows list separator (under control panel|regional settings) doesn't match the separator used in the .CSV file. For instance, with my USA settings, my windows list separator is a comma (,). If I import a file that uses a semicolon (;) as its separator, then all the data goes into a single column. I can either change my windows list separator (temporarily) and then reimport the .CSV file. Or I can select column A and do data|Text to columns and specify the matching separator ...

cannot open documents as viruscan says problem file?
Cannot open files viruscan says problem file. ...

2 versions of same file opened at once
Hi All, I have an abc.xls file. When double-clicking on this filename, the fil opens twice in Excel. Once as abc.xls:1 and once as abc.xls:2 Also when I open the file from within Excel, it opens 2 versions. Both files are identical. What can be the reason why I have 2 version of this file opened simulteanously? How can this be surpassed? Thanks in advance for your feedback. Regards, Pete -- Ba ----------------------------------------------------------------------- Bax's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=3733 View this thread: http://www.excelforu...

Function for transforming long file name in 8.3 format
Hi everybody, I hope not being OT here. I have a long list of names of files in a column (obtained with JDirPrinter utility). I would like to sort the column in ascending 8.3 DOS format name. That is, I need to create or use a function that takes as input a long file name as string, and outputs a short 8.3 file name. Is it possible? Thanks a lot Ciao from Italy Claudio > outputs a short 8.3 file name. Hi. Here's one way: Function ShortName(sFilePath As String) As String '// VBA Library Reference: Microsoft Scripting Runtime Dim fso Set fso = CreateObject("Scriptin...

Excel files opening problem #2
Halo sir, I have installed excel 2003 in windows XP professional machine before that windows xp was installed I have removed the xp and installed 2003 in that machine. Problem is when I am opening the excel files as a administrator it is opening directly when I am trying to open the excel files as a user it is not opening instead I have to select the path where the file is . Just suggest me some idea so that I can get rid of that problem. Regards, syed Sometimes one of these works: Close Excel and Windows Start Button|Run excel /unregserver then W...

Null value in form not trapped by beforeupdate event
I have a form in Access 2003 linked to a SQL Server 2005 table. When I clear the value in a textbox (bound field is varchar and is required), I want the before update event to run to tell the user the value cannot be null. When I press the tab button to move to the next field after clearing the texbox, the before update event is not triggering and instead I'm getting the following error: You tried to assign the Null value to a variable that is not a Variant data type. (Error 3162) How can I prevent nulls before and this error from triggering? Thanks! ...

[OL2003] adding exchange account to profile by PRF file
Hi, a PRF file (as shown below) generates an exchange account within a separately generated profile. I would like to change the PRF file such that the exchange account is added to the already existing profile called "Outlook" such that there is no need to switch profiles all the time. What adjustments are needed? I think section 4 is the most important part. Thanks for your help. Best wishes, J. NB: XXXXXX denotes the account on the exchange server. In the code below it is the name of the profile generated by PRF, as well. ________________ ;Automatically generated PRF file from...

RMS *language.dat files
Hello, Any one of you still have a copy from a previous RMS version (1.2 or 1.3) of the *language.dat (poslanguage.dat, mgrlanguage.dat and qsadministratorlanguage.dat) which content more than 1 language (no matter which one, I just want to see the structure) so I could use it as a reference and therefore try to edit my file which content only English language in order to add 'French' but i`m just wondering which format to use? I do not want to buy from a reseller, I have already translated all the term in french and I only need to know what format I should use to add them a...

Importing .txt data files increases .xls file size
Am importing contact data from our Sales Management Software System into an Excel sheet. The Export process from the SMS system stores the data in a .txt file. Currently we only have about 1000 records, and the .txt file is about 87kb. When I import into Excel through the Import Wizard it adds 500k to the ..xls file size. Now when I split up the data into two alpha groups (A-M; N-Z) it doubles THAT size. Two questions: 1. Is there some way to not increase the file size (maybe during import?) 2. Is there a way to interact with the data from a separate worksheet altogether? -b First thin...

How do I transfer items in the Content Library in Publisher 2007?
I have a number of items in the Content Library in Publisher 2007 on my laptop which I would like to copy to the same program on my PC. I know I could copy and paste them, but there are quite a number and wondered if there is an easy way? Where is the file saved on the hard drive? What version Windows? The Application Data folders are hidden. Read the post from Amanda-BC-Can dated 11/22. She said she failed transferring the content library. If you succeed would you please post back and tell us the steps you used. Under Vista it is stored in this folder: C:\Users\<YOUR USER NAME>...

My document is encoded how do I read it?
when I downloaded my document and tried to open it in microsoft it was encoded. How do I get it where I can read it? Maybe it's a pdf, and you can't open it in "microsoft" but only in "adobe" (or one of the many pdf readers out there). By "microsoft," you mean Word? By "adobe," I mean Adobe Reader, which you can get for free from just about anywhere. On Jan 25, 2:09=A0pm, amanda <ama...@discussions.microsoft.com> wrote: > when I downloaded my document and tried to open it in microsoft it was > encoded. =A0How do I get ...

Copy Partial Cell Contents in Excel ?
Hi folks! I'm trying to figure out how to write a Macro in Excel that I can us to copy only a portion of data in a cell and paste that partial dat into an adjacent cell. Specifically, I am using Excel 2000 and tring t copy only the final dollar amount from entries such as the one below: 1@ $5.99 = $5.99 What I want is a pure dollar amount in the adjacent column so that can run totals of amounts spent. What I don't want is to have to cop and paste every entry manually. Can anyone help me with this -- Message posted from http://www.ExcelForum.com MadDubhgal, That cell should be ...

HELP! Split cell contents to new rows
I know how to split cell contents to columns, but how do you tell excel to take the cell contents and insert into new rows. Each name is separated by a comma and I need each name to appear in its own row beneath that cell. PLEASE HELP! Copy, paste special-transpose (now in columns). Data - Text to columns. Copy, paste special- transpose back to rows. -- Best Regards, Luke M "nyarce" <nyarce@discussions.microsoft.com> wrote in message news:E9E6CDF2-7A05-4337-B0DD-C88FCFF617B4@microsoft.com... >I know how to split cell contents to columns, but how do yo...

shared files problems
I have a file I share with some other people. I have it open almost all the time. Used to be when other people wanted into it, they could open a read-only copy. Then my hard drive blew up, and after fixing it, now they get an error message about not being able to open it. What do I change to get it back the way it was? Thanks how are they trying to open it? If it was a shortcut, then the link is gone and they need to re-connect to your computer. "russ b" wrote: > I have a file I share with some other people. I have it open almost all the > time. Us...

Delete contents of folder on exiting
Does anyone know if its possible to delete the contents of a Outlook 2000 folder when exiting from Outlook (much like the deleted items get emptied). We have a GFI MailEssentials on our Exchange server that moves any emails it recognises as spam to a Junk folder and i'd like to be able to delete the contents of it automatically when i close Outlook, rather than having to do it manually. -- Thanks in advance Dan Williams Dan Williams <dan_williams@newcross-nursing.com> wrote: > Does anyone know if its possible to delete the contents of a Outlook > 2000 folder when exiting ...

Send email without read access for queues
I got the problem that a user should be able to send emails with the webclient but he should not be able to see the defined queues. Thats not possible. In my opinion it does not make sense at all that you need read privileges on queues to send emails out of the web client. That should be changed. My suggestions are: 1. Let users send emails when they have the privilege to create activities. or 2. Define a new privilege for sending emails AND (I find that one pretty important) 3. Show only those items in the queue that a user has at least read privileges for. In my case the user doe...