Skip to content

Tag: arrays

C++, addresses in array [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 7 years ago. Improve this question I have some sort of funny question about addresses in C++. I have such code: This code works…

passing bash array to python list

I’m trying to pass an array from bash to python using the old getenv method however I keep getting this error: could someone please explain why the $mdcNo isn’t passing from bash to python successfully? Code .sh: code .py: Answer If you want to pass a shell array to the Python script, your best be…

Convert char array of C into string of C++

I need to convert char array of C into string c++ but the char array is an element of struct. Code: This is my Structure in C and I want to access name[50] in c++ but for that I have to convert it into string. I have tried strcpy and memcpy. I am using ESL_BOOL status; and it is working

How to read a file line by line

I try to read a file line by line. File to read: Script: When I execute the script, this window will be opened: (Notice how some values are repeated, and the contents don’t correctly alternate between names and versions): I’d like to create an array with all package names and versions. Answer You …

ruby Array.inspect vs. Array[element].to_s

I’m working with an array, which we’ll call books, of complex objects, which we’ll call Book. The problem is when I call puts “#{books.inspect}”, ruby outputs a stream of binary (unreadable utf8 characters). However, when I call puts #{books[0].to_str}”, I get a brief, pret…