Click here to Skip to main content
11,412,833 members (73,091 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ C Visual-Studio file
Here is mine to parse the file video file

int parsingmain1(char *Filepath){
	 FILE* infile;
 
    uint8_t* buf = (uint8_t*)malloc(BUFSIZE );
 
    h264_stream_t* h = h264_new();
 
    /*if (argc < 2) { usage(); return EXIT_FAILURE; }*/
	 infile = fopen(Filepath, "rb");
 

 
    if (infile == NULL) { fprintf( stderr, "!! Error: could not open file: %s \n", strerror(errno)); exit(EXIT_FAILURE); }
	h264_dbgfile = fopen ("C:\\myfile.txt","w");
   /* if (h264_dbgfile == NULL) { h264_dbgfile = stdout; }*/
    int opt_verbose = 1;
    int opt_probe = 0;
	 size_t rsz = 0;
    size_t sz = 0;
    int64_t off = 0;
    uint8_t* p = buf;
 
    int nal_start, nal_end;
	   while (1)
    {
        rsz = fread(buf + sz, 1, BUFSIZE - sz, infile);
        if (rsz == 0)
        {
            if (ferror(infile)) { fprintf( stderr, "!! Error: read failed: %s \n", strerror(errno)); break; }
            break;  // if (feof(infile)) 
        }
 
        sz += rsz;
 
        while (find_nal_unit(p, sz, &nal_start, &nal_end) > 0)
        {
            //here i want to save the data from the file of which i have given the path into an array(2d or 1d) of length specified by nal_start and nal_end
        }
    }
return 0;
}

Please provide the pseudo code
Posted 26-Dec-12 0:51am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You need to make the storage type video as:
{
string name;
string location;
}
and so on...

So if your object is stored as a byte array it would be:

video[] Video = new video[255]; 

This would give 256 videos. I would also recommend using lists not arrays but this is what you wanted.
  Permalink  
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 379
1 Sascha Lefévre 200
2 Maciej Los 150
3 ProgramFOX 130
4 Sergey Alexandrovich Kryukov 110
0 Sergey Alexandrovich Kryukov 9,025
1 OriginalGriff 7,317
2 Maciej Los 3,570
3 Abhinav S 3,298
4 Peter Leow 3,084


Advertise | Privacy | Mobile
Web03 | 2.8.150427.1 | Last Updated 30 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100