Custom Resource -> Char

This is a discussion on Custom Resource -> Char within the Windows Programming forums, part of the Platform Specific Boards category; Hi, I have a text file as a custom resource in my project, i need to read the whole file ...

  1. #1
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339

    Custom Resource -> Char

    Hi,

    I have a text file as a custom resource in my project, i need to read the whole file into a char. I have no idea how to do this, does anyone know?

    Thanks
    TNT
    TNT
    You Can Stop Me, But You Cant Stop Us All

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    The example I gave in the following link shows how to access a resource at runtime and gain a pointer to it's data - here

    I think this is what you are refering to....but I dont fully understand your question

  3. #3
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339
    Hey,

    Im not 100% sure that was what i needed but i may be wrong, sorry i didnt make my question clearer.

    I have a .txt file as a custom resource in my project. I need to read this text file in to a char array. Basically rather than reading a file from the hdd into a string, i need to read it from my programs resources into a string.

    Sorry if i am wrong and that link you gave me is the correct info.

    Thanks again,
    TNT
    TNT
    You Can Stop Me, But You Cant Stop Us All

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Its almost the right info......all I do there is search for a resource in my exe.......load it....then lock it....this lock gives a pointer to the data inside the resource..........also notice I use SizeofResource() to tell me how much data to read from that resource......

    So you have;
    [list=1][*]A pointer to the data[*]A variable with the amount of data to read[/list=1]

    That's all you will need as far as I can see......from that info, copying the data to an array should be child's play

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  2. Conversion Char To Char * Problem
    By ltanusaputra in forum Windows Programming
    Replies: 3
    Last Post: 03-01-2008, 01:06 PM
  3. Need help understanding info in a header file
    By hicpics in forum C Programming
    Replies: 8
    Last Post: 12-02-2005, 11:36 AM
  4. Program Crashing
    By Pressure in forum C Programming
    Replies: 3
    Last Post: 04-18-2005, 10:28 PM
  5. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 04:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21