Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
C

canniballl

@canniballl
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • NT User ID Using Visual C++
    C canniballl

    I have to write a very small app in VC++ for my small shop. They want it written in VC++, otherwise I'd do this in Java or C#. Anyway, at one point, they want to record which NT USER performed a transaction. They specifically said: "We want whatever Windows XP recognizes the current user as. So, whoever is logged into Windows, user their ID." How do I do this? In really easy in Java and C#, but I don't know offhand how to do it in VC++. Info: Windows XP Pro (Some MIGHT have Win2000, but 99% have XP) I did this once in VB (might have hit a .dll to get the info) and it still works under XP. But the code is gone, so I don't know which DLL. Thanks, Chris

    C / C++ / MFC c++ question csharp java tutorial

  • reading in a file and storing the words in a char[]
    C canniballl

    Here's your problem: strcpy() copies the contents from one character-array to another. in the string class, c_str points to the char-array (which is good). However, you're telling strcpy() to copy the contents of c_str to a single character in the array (Name[i] signifies the i-th character in Name). Looking at your strcuture, it "LOOKS" like Name and Unit are supposed to be character-arrays (strings) of length 47, and there are 10 elements of type TSimHeader, which equates to 10 character-arrays (string) of length 47. If this is the case, you must change the loop for 10 entries instead of 47. string name, unit,min,max,value ; for(int i = 0 ; i < 10 ; i++){ getline(fin, name, ',') ; if(name == "STOP") break ; getline(fin, unit, ',') ; getline(fin, min, ',') ; getline(fin, max, ',') ; getline(fin, value) ; // The following assumes that name and unit // are less than 47 characters long strcpy(TSimHeader_arr[i].Name, name.c_str()) ; strcpy(TSimHeader_arr[i].Unit, unit.c_str()) ; TSimHeader_arr[i].Min[i] = atof(min.c_str()) ; TSimHeader_arr[i].Max[i] = atof(max.c_str()) ; TSimSignal_arr[i].Value[i] = atof(value.c_str()) ; sig_count ++ ; } Again, this is assuming I interpretted this correctly.

    C / C++ / MFC help c++ data-structures
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups