Note that there are some explanatory texts on larger screens.

plurals
  1. POReading a line from a file and parsing it in C
    primarykey
    data
    text
    <p>I'm a student and learning C language. For my assignment, I have a txt file and I'm getting the commands from that, such as </p> <pre><code> S X 11,156;21,234 </code></pre> <p>the first 2 characters are directing me, and I don't have any problems with them, they will be solved with many switches.</p> <p>The numbers are important, and I must stack them. Commas seperating the attributes and semicolons seperate the main elements. Like; first attribute of the first element is 11, the first attribute of the second element is 76 etc. I can put those attributes to 2 different stacks. </p> <p>I will process the first attributes later, so the first attributes must be float type between 10-99. Second attributes are integers between 100-999. </p> <p>The attributes will be given randomly and I don't know how many elements will be, but I'm sure there will be 20 elements max.</p> <p>Structs are not allowed (I don't even know what they are), so I must create a stack with strings.</p> <p>I'm new to "stack" concept, so I couldn't create it myself. So can you help me with creating a stack with these numbers?</p> <p>(I searched the site many times but I couldn't find any matching questions.)</p> <p>I tried to create 2 strings for attributes and used strncat functions to add the numbers but all I could do was get the numbers as '1', '1', '4' etc but it failed as I need those numbers as "11", "156" etc.. How can I get those numbers like that?</p> <p>What I tried was;</p> <pre><code> strncat (str1, row+x, 2); strncat (str2, row+x+2, 3); strcat (str1, ", "); strcat (str2, ", "); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload