CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Apr 2003
    Posts
    93

    Post Filling struct with data...

    Hi,

    This is my struct and it's enum

    Code:
    enum Length
    {
    	EventType = 2,
    	LogNumber = 1,
    	EventSequence = 4,
    	VarianceCode = 3,
    	ExactAirTime = 8,
    	ScheduledTime = 8,
    	ScheduledTimeMode = 1,
    	EventDuration = 8,
    	VideoSource = 12,
    	VideoEffects = 10,
    	AudioSource = 12,
    	AudioEffects = 10,
    	HouseNumber = 20,
    	TimeCodeIn = 8,
    	TimeCodeOut = 8,
    	FCCSource = 1,
    	Description = 30,
    	FacilityDescription = 30,
    	FCCType = 10,
    	SecondarySource = 1,
    	RecordType = 1,
    	Offset = 5,
    	NewShowFlag = 1,
    	SegmentNumber = 2,
    	Unused = 6
    };
    
    struct playlistContents
    {
    	int EventType;
    	int LogNumber;
    	int EventSequence;
    	char VarianceCode[VarianceCode]; // Not Used
    	char ExactAirTime[ExactAirTime];
    	char ScheduledTime[ScheduledTime];
    	char ScheduledTimeMode; // Only 1 byte, either T or White Space
    	char EventDuration[EventDuration];
    	char VideoSource[VideoSource];
    	char VideoEffects[VideoEffects]; // Not Populated (possibly used though)
    	char AudioSource[AudioSource];
    	char AudioEffects[AudioEffects]; // Same as Video Effects
    	char HouseNumber[HouseNumber];
    	char TimeCodeIn[TimeCodeIn];
    	char TimeCodeOut[TimeCodeOut];
    	char FCCSource; //Only 1 bytes Not too sure whats in it, it's either WhiteSpace, or something else.
    	char Description[Description]; //Title
    	char FacilityDescription[FacilityDescription];
    	char FCCType[FCCType];
    	char SecondarySource; // Either Y or WhiteSpace
    	char RecordType; //I = Interstitial, P = Programme, S = Commercial.
    	char Offset[Offset]; //White space in the file. (Not Populated)
    	char NewShow; //Flag for a New show. If Repeat = No then Flag = Y else Blank.
    	char SegmentNumber[SegmentNumber]; //Part Number
    	char Unused[Unused]; // As name states.
    };
    When i try to fill that struct with data, it comes out totally wrong in the compiler.

    Code:
                    playlistContents *pc = new playlistContents;
    	ZeroMemory(pc, sizeof(playlistContents));
    
    	strcpy(pc->VarianceCode, "123");
    	strcpy(pc->ExactAirTime, "12345678");
    	strcpy(pc->ScheduledTime, "12345678");
     
    	//Breakpoint here to check variables.
                    delete pc;
    when i check to see what the variables contain, it comes out like this! (Check attachment)

    I'm not sure if i'm doing anything wrong...and im looking for any help please!

    Thanks!

    Dean.
    Attached Images Attached Images
    OutputDebugString(...); Is your friend!
    http://www.spikedsoftware.co.uk

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured