Question

How do you read a file in node.js, create a string of arrays and pass that...

How do you read a file in node.js, create a string of arrays and pass that to c++?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1) To access file system we need to use require('fs') in node.js.

Implementation:

var fs = require('fs');

fs.readFile(

  1. 'file_name', 'utf8', function(err, contents) {

           console.log(contents);});

//prints contents

please explain the second part of question in comments sections so that I can modify and give you answer .

I couldn't get what you needed.

Add a comment
Know the answer?
Add Answer to:
How do you read a file in node.js, create a string of arrays and pass that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need to write a C++ program where I need to read in a file and...

    I need to write a C++ program where I need to read in a file and do somethings with information inside the file. We can NOT use arrays. The picture below is what is in the file. My question is how do I read in the file and return the number of studies ( the 5 in the file ) so I can pass it through an other funciton. we need to use ofstream commands.

  • Do not use global variables. Pass your arguments by value and by reference (address). Using arrays...

    Do not use global variables. Pass your arguments by value and by reference (address). Using arrays and modular programming techniques (i.e. functions), write a C-program which accepts two strings and determines whether one string is an anagram of the other, that is, whether one string is a permutation of the characters in the other string. For example, “dear” is an anagram of “read”, as is “dare”. Also, anagrams of “monday” could be “don may” or “do many”, but not “mad”....

  • IN JAVA Read the runners data file into arrays. ONE string array and ONE 2-dimension array....

    IN JAVA Read the runners data file into arrays. ONE string array and ONE 2-dimension array. Each runner has 8 pieces of data, which includes name, and how much they ran for each of 7 days. Print out the raw data in columns. Below the raw data, print out the total miles ran for all of the runners. THIS IS TXT FILE : Keith 10 8 4 5 12 3 2 Anna 9 8 7 6 5 12 13 Derick...

  • Arrays and reading from a file USE C++ to write a program that will read a...

    Arrays and reading from a file USE C++ to write a program that will read a file containing floating point numbers, store the numbers into an array, count how many numbers were in the file, then output the numbers in reverse order. The program should only use one array and that array should not be changed after the numbers have been read. You should assume that the file does not contain more than 100 floating point numbers. The file name...

  • How do I create a simple java program file that opens and reads a file using...

    How do I create a simple java program file that opens and reads a file using java.io? I have the file Im supposed to open and read but I dont know how to code it to open and read the file?

  • Therefore, for this program you will read the data in the file named weatherdata_2.txt into arrays...

    Therefore, for this program you will read the data in the file named weatherdata_2.txt into arrays for the wind speed and for the temperature. You will then use the stored data to calculate and output the average wind speed and the average temperature. Create a constant with a value of 30 and use that to declare and loop through your arrays and as a divisor to produce your averages. Here is the data file (below). 1. 14 25 2. 12...

  • File Processing and Arrays Create a class named FilesAndArrays. Download the sidewalk.txt file so it is...

    File Processing and Arrays Create a class named FilesAndArrays. Download the sidewalk.txt file so it is in your project’s root folder. Write a static method named findFirstMatch that accepts as its parameters a Scanner for an input file and an array of Strings keywords representing a list of keywords in a search. Your method will read lines from its input Scanner and should return the line number of the first line in the file that contains one or more words...

  • using c only You will read in two strings from a file cp4in_1.txt at a time...

    using c only You will read in two strings from a file cp4in_1.txt at a time (there will be 2n strings, and you will read them until EOF) and then do the following. You alternately take characters from the two strings and string them together and create a new string which you will store in a new string variable. You may assume that each string is no more than 20 characters long (not including the null terminator), but can be...

  • C++ Implement Random Access Binary Files. Do Not use Arrays instead write the data directly to...

    C++ Implement Random Access Binary Files. Do Not use Arrays instead write the data directly to Random Access Binary File. New program should be modified to display a menu for the user to do the following: 1. Replace Employee and Department classes with Employee and Department Structures. 2. Inside each structure, replace all string variables with array of characters. 3. Make Employee and Department editable. That means, the user should be able to edit a given Employee and Department. 4....

  • C++ Implement Random Access Binary Files. Do Not use Arrays instead write the data directly to...

    C++ Implement Random Access Binary Files. Do Not use Arrays instead write the data directly to Random Access Binary File. New program should be modified to display a menu for the user to do the following: 1. Replace Employee and Department classes with Employee and Department Structures. 2. Inside each structure, replace all string variables with array of characters. 3. Make Employee and Department editable. That means, the user should be able to edit a given Employee and Department. 4....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT