1 Replies - 295 Views - Last Post: 10 January 2013 - 01:46 PM Rate Topic: -----

#1 grimscorpios  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 10-January 13

Environmental Variables in to Array List

Posted 10 January 2013 - 11:52 AM

Problem: Cannot put environmental variables into a neat list on output:
Tried solutions: Thought an array list might work, however i am struggling to understand how i would go about it.

The working Code:

#include <iostream>
int main(int,char **,char ** envp) {
for(int i=0;envp[i]!=NULL;i++)
  std::cout << envp[i];
 system ("pause"); return 0;
}



This displays the environmental variables. How would i list them neatly.
An array? or another way?
Please help.

This post has been edited by Skydiver: 10 January 2013 - 06:09 PM
Reason for edit:: Put code in code tags. Please do it yourself in the future.


Is This A Good Question/Topic? 0
  • +

Replies To: Environmental Variables in to Array List

#2 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3576
  • View blog
  • Posts: 11,121
  • Joined: 05-May 12

Re: Environmental Variables in to Array List

Posted 10 January 2013 - 01:46 PM

Perhaps just adding line break between each loop iteration would help. (e.g. cout << endl; )
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1