Update a struct

This is a discussion on Update a struct within the C Programming forums, part of the General Programming Boards category; There may be a quick answer to this question but... If I have a struct, is there anyway to parse ...

  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,006
    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, 09:54 PM
  4. What's wrong with my search program?
    By sherwi in forum C Programming
    Replies: 5
    Last Post: 04-28-2006, 10: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, 04:00 PM

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