file

How to Make Your Computer Change Java Path

耗尽温柔 提交于 2021-02-11 13:00:18
问题 So a while back I installed some .jar files for game mods, which seems to have installed the 1.8 JRE on my computer. Now, I installed JDK 14, however, my computer still thinks that my Java version is 1.8. I have two Java folders on my computer - one in Program Files with the JDK, and one in Program Files (x86) with the old JRE. I set the JAVA_HOME environment variable to the directory of the JDK but when I type java -version in my Command Prompt it still says 1.8. How do I get my computer to

How to Make Your Computer Change Java Path

可紊 提交于 2021-02-11 12:59:07
问题 So a while back I installed some .jar files for game mods, which seems to have installed the 1.8 JRE on my computer. Now, I installed JDK 14, however, my computer still thinks that my Java version is 1.8. I have two Java folders on my computer - one in Program Files with the JDK, and one in Program Files (x86) with the old JRE. I set the JAVA_HOME environment variable to the directory of the JDK but when I type java -version in my Command Prompt it still says 1.8. How do I get my computer to

Bash Script changing the output file for every file

Deadly 提交于 2021-02-11 12:40:19
问题 I'm trying to use a command on everyfile .log in a folder but I can't understand how to change the output file for every file in the folder. #!/bin/bash N="0" for i in "*.log" do echo "Processing $f file..." cat $i | grep "test" | awk '/show/ {a = $1} !/show/{print a,$6}' > "log$N.txt" done How can i increment the counter for log$n.txt? 回答1: It's bad practice to write shell loops just to process text (see https://unix.stackexchange.com/questions/169716/why-is-using-a-shell-loop-to-process

Bash Script changing the output file for every file

给你一囗甜甜゛ 提交于 2021-02-11 12:39:15
问题 I'm trying to use a command on everyfile .log in a folder but I can't understand how to change the output file for every file in the folder. #!/bin/bash N="0" for i in "*.log" do echo "Processing $f file..." cat $i | grep "test" | awk '/show/ {a = $1} !/show/{print a,$6}' > "log$N.txt" done How can i increment the counter for log$n.txt? 回答1: It's bad practice to write shell loops just to process text (see https://unix.stackexchange.com/questions/169716/why-is-using-a-shell-loop-to-process

How to read decimal numbers from a file which has non-English (Turkish) content in C

随声附和 提交于 2021-02-11 12:32:20
问题 I have a file and I am trying to multiply the amount of unit entered with the price if the price is int, it is ok but it does not have a decimal value of 0.0000 result. Thank you. #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <string.h> #include <locale.h> int main() { int birim; // unit float birim_fiyat; // unit price char barkod[10]; // barcode char kategori[10], urunadi[10], istenen[10]; float ucret=0.00; //price setlocale(LC_ALL,"Turkish"); FILE *fp=fopen("barkod.txt

How to work with records using file stream I/O instead of the 'old' I/O

好久不见. 提交于 2021-02-11 12:03:05
问题 Never learnt to work with streams for reading / writing data, instead I'm using the old Pascal way. Now everybody says this is not efficient and I would like to learn the file stream way, but can't really work with the tutorials that are available. I am using Excel to create and manage datasets (big data tables with one or two headers). I save these as *.txt files (tab delimited). These files I read with Delphi to fill my records and arrays, etc. Below a simplified code example of what I am

Automatically open files given as command line arguments in Python

自古美人都是妖i 提交于 2021-02-11 10:54:10
问题 I have a lot of Perl scripts that looks something like the following. What it does is that it will automatically open any file given as a command line argument and in this case print the content of that file. If no file is given it will instead read from standard input. while ( <> ) { print $_; } Is there a way to do something similar in Python without having to explicitly open each file? 回答1: The fileinput module in Python's standard library is designed exactly for this purpose, and I quote

write xth row in file in Java

我的梦境 提交于 2021-02-11 10:11:33
问题 in Java, suppose I have a text file with n rows, is it possible to only write and replace row x? or do I rewrite all the rows in order to edit any row? It seems that I have use RandomAccess File to read x-1 lines, and then call f.writeChars(str+"\n"); would this work? but also it won't delete the existing xth line.. 回答1: If you're not changing the line length, you can simply overwrite the original data. If you need to change the line length, or add (or remove) a row in the middle of the file,

how to mount a file share in azure service fabric

夙愿已清 提交于 2021-02-11 08:48:23
问题 I need to access files using standard file API in a Service Fabric service. My application read from files and write to files that are stored in a File Share; each node process a different part of the data. I'm using the "SetupEntryPoint" to run a batch file with a "net use" command to mount a local drive to my file share but it fails (both on my local machine and when deployed on Azure). I'm referring to this article. The same batch runs well on a regular virtual machine but fails on a

opening a file based on user input c++

做~自己de王妃 提交于 2021-02-11 08:01:54
问题 I am trying to make a program that would open a file based on the users input. Here`s my code: #include <iostream> #include <fstream> #include <string> using namespace std; int main() { string filename; ifstream fileC; cout<<"which file do you want to open?"; cin>>filename; fileC.open(filename); fileC<<"lalala"; fileC.close; return 0; } But when I compile it, it gives me this error: [Error] no match for 'operator<<' (operand types are 'std::ifstream {aka std::basic_ifstream<char>}' and 'const