what can I do about to struct

> To all:
     struct indexhead{
>         char Mark[9];
>         char MainVer;
>         char SubVer;
>         short IdxNum;
>         char Reserved[5];
>     };
May I do so that:
> void SetindexHead()
> {
>        indexhead indexhd;
>     indexhd.IdxNum=1;
>          indexhd.Mark[9]="dfadf";
> .....
>
> }

I know It is Error,but I dont know why?

one of Reply is appreciated.



0
terrcy (22)
4/26/2004 1:34:28 AM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
345 Views

Similar Articles

[PageSpeed] 49

Ok,It is my answer!
thanks
"Scott McPhillips [MVP]" <scottmcp@mvps.org.nothere> wrote in message
news:OoQ2JEzKEHA.3332@TK2MSFTNGP10.phx.gbl...
> terrcy wrote:
> >>To all:
> >
> >      struct indexhead{
> >
> >>        char Mark[9];
> >>        char MainVer;
> >>        char SubVer;
> >>        short IdxNum;
> >>        char Reserved[5];
> >>    };
> >
> > May I do so that:
> >
> >>void SetindexHead()
> >>{
> >>       indexhead indexhd;
> >>    indexhd.IdxNum=1;
> >>         indexhd.Mark[9]="dfadf";
> >>.....
> >>
> >>}
> >
> >
> > I know It is Error,but I dont know why?
> >
> > one of Reply is appreciated.
> >
> >
> >
>
> It is an error because "dfadf" is type char[] but Mark[9] is type char.
>   (Note that it is also the 10th character of a 9 character array,
> another mistake!)
>
> C++ classes such as string or CString can do this for you.  C char
> arrays cannot.
>
> --
> Scott McPhillips [VC++ MVP]
>


0
terrcy (22)
4/26/2004 1:59:20 AM
terrcy wrote:
>>To all:
> 
>      struct indexhead{
> 
>>        char Mark[9];
>>        char MainVer;
>>        char SubVer;
>>        short IdxNum;
>>        char Reserved[5];
>>    };
> 
> May I do so that:
> 
>>void SetindexHead()
>>{
>>       indexhead indexhd;
>>    indexhd.IdxNum=1;
>>         indexhd.Mark[9]="dfadf";
>>.....
>>
>>}
> 
> 
> I know It is Error,but I dont know why?
> 
> one of Reply is appreciated.
> 
> 
> 

It is an error because "dfadf" is type char[] but Mark[9] is type char. 
  (Note that it is also the 10th character of a 9 character array, 
another mistake!)

C++ classes such as string or CString can do this for you.  C char 
arrays cannot.

-- 
Scott McPhillips [VC++ MVP]

0
scottmcp8856 (490)
4/26/2004 2:51:20 AM
"terrcy" <terrcy@cn-finet.com> wrote in message
news:uVNy06yKEHA.3076@TK2MSFTNGP10.phx.gbl...
> > To all:
>      struct indexhead{
> >         char Mark[9];
> >         char MainVer;
> >         char SubVer;
> >         short IdxNum;
> >         char Reserved[5];
> >     };
> May I do so that:
> > void SetindexHead()
> > {
> >        indexhead indexhd;
> >     indexhd.IdxNum=1;
> >          indexhd.Mark[9]="dfadf";
> > .....
> >
> > }
>
> I know It is Error,but I dont know why?
>
> one of Reply is appreciated.

    First, a char is not a string.  you can assign 'd' to mark[8], but not
"dfadf".  Second, an array with nine elements has elements numbered 0 to 8.

    What you probably want is
        CString Mark[9];

    then you can use
          indexhd.Mark[8]="dfadf";

                                Nathan Holt



0
nathanh (83)
4/26/2004 2:34:22 PM
you are kindly,ths
"Nathan Holt" <nathanh@ccei-nm.com> wrote in message
news:c6j7k1$eg$1@reader2.nmix.net...
>
> "terrcy" <terrcy@cn-finet.com> wrote in message
> news:uVNy06yKEHA.3076@TK2MSFTNGP10.phx.gbl...
> > > To all:
> >      struct indexhead{
> > >         char Mark[9];
> > >         char MainVer;
> > >         char SubVer;
> > >         short IdxNum;
> > >         char Reserved[5];
> > >     };
> > May I do so that:
> > > void SetindexHead()
> > > {
> > >        indexhead indexhd;
> > >     indexhd.IdxNum=1;
> > >          indexhd.Mark[9]="dfadf";
> > > .....
> > >
> > > }
> >
> > I know It is Error,but I dont know why?
> >
> > one of Reply is appreciated.
>
>     First, a char is not a string.  you can assign 'd' to mark[8], but not
> "dfadf".  Second, an array with nine elements has elements numbered 0 to
8.
>
>     What you probably want is
>         CString Mark[9];
>
>     then you can use
>           indexhd.Mark[8]="dfadf";
>
>                                 Nathan Holt
>
>
>


0
terrcy (22)
4/29/2004 2:32:59 AM
Reply:

Similar Artilces:

Can't send mails only recv
Everytime I try to send an email, it goes to my outbox but never leaves. I notice that if it is in italics, it will leave but if not, it wont. I have tried re-sending the mail but no luck. I use Outlook 2003 from office 2003 professional on windows XP pro. ...

Can I open a .wdb file in Word 2003?
I have an old .wdb file of addresses that I must have created with Works some time ago. After reloading Office 2003 I can no longer open it. Is there a way to convert it to a compatible format? Can I just change the extension? To what? I tried opening it with the suggested programs but all I got was boxes and an occasional letter here and there. On Mon, 21 Dec 2009 19:51:01 -0800, mhw089 <mhw089@discussions.microsoft.com> wrote: >I have an old .wdb file of addresses that I must have created with Works some >time ago. After reloading Office 2003 I can no longer...

newbie , how can I use gdi+ lib
hi , I have downloaded and placed the gdiplus.dll in system32 directory of win98 and use loadlibrary("gdiplus.dll") to bring this up however, the ide post me a complie error. what going wrong for this, thanks Eric Why don't you just statically link it into you project, put gdiplus.lib in the objects bit of the linker settings, or use #pragma comment( lib, "gdipluss" ) in your stdafx.h? M "Eric" <pgeric888@hotmail.com> wrote in message news:O0XrNgDsEHA.736@tk2msftngp13.phx.gbl... > hi , I have downloaded and placed the gdiplus.dll in system32...

Can't publish website as read only?
I cannot upload my website as I get the error message "read only". I have checked the properties of the file and this is not the case. Any ideas? What version of Publisher? Is this message a error dialog you receive when using Publisher to upload the web publication to the web host? If so at what point in the process (ie after the login prompt) do you receive this? Is this a FTP or HTTP upload? In the future use the web forum - microsoft.public.publisher.webdesign David Bartosik - [MSFT MVP] www.publishermvps.com www.davidbartosik.com "QBears" wrote: > I can...

Can I break "% in row" at each subtotal?
If I break a pivot table by one column category, and then a second category, can I calculate "% in row" by the second category, and not across the whole pivot table? Example: I want the % in the rows of Section 1 and Section 2 calculated independently, not as a total. In other words, the rows in each section should be calculated off 100%, not off the subtotal of each section. Confusing, I know. :) 1 Total 2 Total Team CMI DVCI CMI DVCI Unix 34.4% 20.8% 55.2% 21.9% 22.9% 44.8% Network 31.4% 29.9% 61.3% 20.4% 18.2% 38.7% Storage 44.9% 17.3% 62.2% 27.2% 10.6...

can't figure out the formula to use
Hello, I have a SS with 3 columns that look something like this: A:(NAME) B:(Agency[Vlookup Result]) C:(Formula Result) Jones, Joe Agency1 Agency1 A-M Smith, Bob Agency2 Agency2 N-Z Kid, Gregg Agency3 Agency3 Rohl, Jim Agency4 Agency4 **column B is a result of another sheet in the workbook... I am trying to find a formula that would follow this logic: if the 1st letter in A1 is between A-M, and B1 is "Agency1" or "Agency2", then C1 will be 'B1&"A-M"'. i...

How many worksheets can be inserted in one workbook?
I have just started using MS-Excel. I was wondering what is the maximum number of worksheets that can be inserted in 1 MS-Excel Workbook? If I remember correctly, I've seen folks report that they're been able to insert upwards of 1000 sheets (as a test). For practical purposes you're limited by the amount of memory your system has. Search Excel help for "specifications and limits". It says: Sheets in a workbook - Limited by available memory (default is 3 sheets) -- Biff Microsoft Excel MVP "Bobby" <Bobby@discussions.microsoft.com> wrote in messa...

Can't delete mail
Hello, I have a piece of junk mail in my Deleted Items box that I can't get rid of. When I try to delete it from the folder, I get the message that I do not have access to the account. I know this isn't true because I have deleted all of the other items. I've tried deleting the folder but have the same problem. Does anyone know how I can get rid of it? Thanks What type of account and what version of Outlook? -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -Properly back-up and restore your Outlook data -Creating a Permanent New Mail Desktop Ale...

Can't Drag email to folders; works after restart.
So I've got a client that 's running XP2, Outlook 2007 using Exchange; he shows me that after a fresh restart he can drag and drop emails into folders in his inbox... But after 2-3hrs (literally) something happens that prevents him from being able to drag and drop to any folders...then after a restart, it works fine. He says this doesn't happen when using his laptop nor home machine. Which leads me to believe that it's some kind of configuration issue on his work box... anyone ever seen this before? Thanks and any help is appreciated! v12hcmf@gmail.com, you wrote on Fri, 9 ...

Microsoft Outlook
Hi everyone! My microsoft outlook send and receive button has gone.. not in the menu either... i reinstalled hole office 2003 and this outlook problem remains. I have a pop3 account created... Any idea on how to proceed? Did you create the smtp portion of your Outlook profile so you can send? Are you connected to the internet? -- Kathleen Orland - MVP Outlook Outlook Tips: http://www.outlook-tips.net/ http://www.howto-outlook.com/ "Javox" wrote: > Hi everyone! My microsoft outlook send and receive button has gone.. > not in the menu either... i reinstalled hole o...

Can I automatically delete old versions of email threads?
There should be an add in or option to only keep the most recent version of a long involved email thread in your inbox. When I come back from vacation, I want to have ONE version to read. However, sometimes people add new recipients or delete others, and there end up being multiple threads, so I have to check them all. Is there anything out there that does this? I'm not looking for one of the duplicate programs because they are not exactly duplicates. Currently Outlook does not have such an option. FWIW: Outlook 2010 will have a Conversation Cleanup feature. -- ...

Can't close folder
I'm trying to close an archive folder (not the active one) in Outlook 2003 and I keep gettin the error "The operation failed. An object could not be found". Any ideas what object is missing or how I can get this folder closed? ...

Can I convert or compress an Avi file so it will fit on a blank DVD ?
Hello there! Perhaps Panzy or any other experts out there could help me with this? I downloaded the program called 'Videos to DVD converter V3.1' by 'Koyote Soft-2009' which Panzy kindly informed me of but I have come up against a slight problem. I have found the formula to put my downloaded films on to DVD to watch on my regular DVD player using this software. The first three films all Avi's, fitted within the size bands of the DVD window of 4.7 GB or 120 minutes determining the size of my blank DVD's. The last couple of films I have downloaded h...

How can I make a dinner seating arrangement using Excel?
I would like to make a seating arrangement for three round tables and 22 people using Excel. Is this possible? ...

Can't see Potential Customers in Offline Mode
When I go offline and use Outlook for CRM, click on Opportunities to view them, I cannot see the Potential Customers for the accounts I don't own, even though they are shared out to me and I'm a CRM admin. Why is it doing this? Thanks. -- Client Solutions Manager Micro Strategies Hi, You have to define rules for offline mode in Menu CRM. By default, only rule for "My Account" are defined. Regards, Andrey "Kyle Conquy" wrote: > When I go offline and use Outlook for CRM, click on Opportunities to view > them, I cannot see the Potential Customers fo...

Switched hard-drive in laptop, can't get archived Anything??
I bought a larger hard-drive and installed it in my laptop. I did an archive (to an external hard-drive) to save my Outlook. Now I can NOT retrieve it back. I tried the normal way to retrieve it an No go. Any thoughts??? THANKS!! An outlook Archive data file is not a backup of outlook data. What do you consider the 'normal way' of retreiving data? Is the old hard drive still installed or? "croundstream" <croundstream@discussions.microsoft.com> wrote in message news:0AA1C5C7-1926-4F5A-89D5-1362CC21D5A2@microsoft.com... >I bought a larger hard-driv...

how can i open pocket excel files when copying to my laptop
i have pocket excel files which i have copied to my laptop. they won't open because i can't find a reader for the .pxl extension. has anybody solved this yet? ...

How can I highlight major occurences in an array?
I have a spreadsheet which is an all X all matrix/array that shows where all occurrences of certain criteria do and don't occur. Some of the occurrences are more significant than others and these are shown in a separate 2 column table that could be made into a smaller some X some array. How can I overlay the small array over the large array and highlight the duplicates? Ideally I would like to use conditional formatting or similar such that the major occurrences were Green, minor occurrences Amber and no occurrences Red. I have created the matrix from a pivot table in MS Access, ...

How can I show a dialog box "Run As Other User" under Windows2000?
How can I show a dialog box "Run As Other User" under Windows2000? do this programmatically "Marco" <sorry@nomail.com> д���ʼ� news:eVZfAcFqDHA.688@TK2MSFTNGP10.phx.gbl... > How can I show a dialog box "Run As Other User" under Windows2000? > > ...

Can chart previews be turned off
I use excell for charts up to 30 series with as much as 28,000 data points per series, I know what selections I want and do not need previews, is there a way to turn them off so I don't have to contantly wait for the previews to finish everytime I make any change. ...

Can't send mail from other addresses
Hi. I have other old email addresses added to my Windows live so I still receive emails, which I do. However when I try to reply using that email address the server doesn't respond and I'm sure it used to. I get the following :- Your server has unexpectedly terminated the connection. Possible causes for this include server problems, network problems, or a long period of inactivity. Subject 'test' Server: 'smtp.tiscali.co.uk' Windows Live Mail Error ID: 0x800CCC0F Protocol: SMTP Port: 25 Secure(SSL): No Socket Error: 10053 Any ideas please ? Any...

Can you perform ctrl+shift+; in a macro to display time?
I would like to add current but static time to a cell within a larger macro, but the only way I can find to enter just the time and not date as well is to use ctrl+shift+; but it doesn't appear that macro allow the use of hardkeys, although my knowledge of macros is basic i'm sure there must be a work around. Hi Darran Try: '=============>> Public Sub TesterC() With Range("A1") .Value = Time .NumberFormat = "h:mm AM/PM" End With End Sub '<<============= --- Regards, Norman "Darran Parsons" <Darran...

Can Outlook Run in the Background?
In the past, I have worked with Microsoft Outlook Express and have seen it run in the background in the Task bar by the clock and check for messages and give reminders without having to open up Outlook Express entirely (Unless it asks me if I want to do that). I also notice that MSN Messenger runs that way all the time. My question is: Can Outlook run in the background like Outlook Express and MSN Messenger??? I would love that feature to be made available in the future. Thank you. Outlook 2003, yes. Just right click on outlook icon in system tray (area next to clock when its run...

can't import pst file
get error message "File access is denied. You do not have permission to access the file C:\Data\Mike\Contacts\MP Outlook backup file.pst." Any worked with this before? Thanks. mike <anonymous@discussions.microsoft.com> wrote: > get error message "File access is denied. You do not have > permission to access the file C:\Data\Mike\Contacts\MP > Outlook backup file.pst." What happens when you 1) make sure that file is not read-only and 2) use Outlook's File>Open command to open it? (Never import an existing PST file.) Okay, how do I make sure th...

Can't see eccentricity handles on arc shape
According to MS help, if you click on the control point of an arc with the pencil tool, while holding the CTRL key, you will see the arc's eccentricity handles. I've tried this and it doesn't work. Is there an option or some other method of being able to do this? Thanks. Dan After you've drawn the arc, and assuming you're zoomed in close enough, selectiing the pencil tool will highlight the deflection node. Click on this with the pencil tool and the deflection handles should appear. "Dan Forest" wrote: > According to MS help, if you click on the contr...