assigning string to int

From: Ben (crescent_au_at_yahoo.com)
Date: 05/29/04


Date: 29 May 2004 09:48:55 -0700

Hi all,

I would like to know if there is an easy way to assign a string to an int.

I have a struct such as:

  struct Values {
    int a;
    int b;
  }

I have 2 strings that i read from a file:
  string x = "12";
  string y = "10";

Now I'd like to do something like this:
  Values val;
  val.a = x;
  val.b = y;

There is of course a mis-match.. How do I fix it? Is there an easy way?

Thanx for help!
Ben



Relevant Pages

  • [git patches] net driver fixes
    ... Fix NAPI state bug when Rx complete ... const struct cmac_statistics *s; ... int flag) ...
    (Linux-Kernel)
  • [git patches] net driver updates
    ... Fix PHY Lib support for gianfar and ucc_geth ... int mii_status; ... struct vio_dev *vio_dev) ... struct net_device *dev; ...
    (Linux-Kernel)
  • [git patches] net driver updates
    ... Fix locking in ethtool support ... static int au1000_init ... if (err) { ... * @adapter: board private struct ...
    (Linux-Kernel)
  • [git patches] net driver fixes
    ... wext: Fix IWENCODEEXT security permissions ... int fast_scan; ... struct ieee80211_device *ieee; ... return err; ...
    (Linux-Kernel)
  • [PATCH] NFS: Fix race in nfs_release_page()
    ... In order to fix this, NFS has hooked the releasepagemethod and tries ... attempt to write out a dirty page without releasing the page lock. ... int ... int (struct address_space *, ...
    (Linux-Kernel)