Thread: String as Resource in txt file

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User KeithS's Avatar
    Join Date
    Jul 2009
    Location
    Colombia
    Posts
    21
    Quote Originally Posted by bithub View Post
    Code:
    LoadString(GetModuleHandle(NULL), IDS_STRING, szBuffer, 0);
    Shouldn't that be:
    Code:
    LoadString(GetModuleHandle(NULL), IDS_STRING, szBuffer, sizeof(szBuffer) / sizeof(TCHAR));
    That makes perfect sense... now that you've pointed it out. Thanks!

  2. #2
    Registered User KeithS's Avatar
    Join Date
    Jul 2009
    Location
    Colombia
    Posts
    21
    Quote Originally Posted by KeithS View Post
    That makes perfect sense... now that you've pointed it out. Thanks!
    But it was not it, unfortunately.

    However, I am a bit clearer on what objective I am after now. It is like this;

    1). Embed a text file as a resource.
    2). Access text file resource from the application.
    3). Format its contents into char strings.

    I tried using "CreateFile" with "GENERIC_READ", and attempting to "TEXT(MAKEINTRESOURCE)" of the text file resource. No luck. String tables in the *.rc file I can do no problem, but it is not appropriate to the goal. The eventual application I am doing this for will have quite a volume of text (it is a question bank) and needs to be updated about every six months, plus the text file must not be accessible to users.

    Is what I am trying to do possible?

    There must be alternate options. If anyone knows one, or has had a similar experience to which they found a solution, please let me know. Thanks in advance...

  3. #3
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Quote Originally Posted by KeithS View Post
    The eventual application I am doing this for will have quite a volume of text (it is a question bank) and needs to be updated about every six months, plus the text file must not be accessible to users.
    Embedding the file in the exe will require redistrobuting the exe on every update.

    Also opening the exe in a hex editor (UltraEdit, MSVC etc) will display the text in a readable form (as it is stored in congruent memory).

    These may not be issues for your app however.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  2. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  3. Headers that use each other
    By nickname_changed in forum C++ Programming
    Replies: 7
    Last Post: 10-03-2003, 04:25 AM
  4. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 03:23 PM