Thread: Update a struct

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    4

    Update a struct

    There may be a quick answer to this question but...

    If I have a struct, is there anyway to parse an sql-like statement and update structs?

    For example, if I have a struct like:

    struct customers (
    name char [32];
    address char [128];
    );

    and a statment like "insert into customers (name, address) values ("John Doe", "Central Park");"

    I can parse the string to get name = "john doe" and address = "Central Park", but could I create a string like customers.name="john doe" and use this to access and update the struct?

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    First, please use copy and paste -- all relevant code -- instead of typing anew, because your struct has laughable errors.

    If you can parse it into one string, there should be nothing stopping you from parsing it into any other string, right? It's just the name of the string you are parsing it into that you seem to be wrestling against.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 03-05-2009, 10:25 AM
  2. Link List math
    By t014y in forum C Programming
    Replies: 17
    Last Post: 02-20-2009, 06:55 PM
  3. newbie needs help with code
    By compudude86 in forum C Programming
    Replies: 6
    Last Post: 07-23-2006, 08:54 PM
  4. What's wrong with my search program?
    By sherwi in forum C Programming
    Replies: 5
    Last Post: 04-28-2006, 09:57 AM
  5. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM