C# :: How To Fetch Particular Text From A String
Jan 15, 2015I have a string (zoneId==176)&&((startTime==100)&&(endTime==1200)) from which i want to fetch value of startTime and endTime in C#.
View 7 RepliesI have a string (zoneId==176)&&((startTime==100)&&(endTime==1200)) from which i want to fetch value of startTime and endTime in C#.
View 7 RepliesI am Using a fingerprint Scanner for attendance posting.
finger print reader vendor is essl,model is[URL] The device is connected on lan,It has option to download the users list and attendance list to pendrive in .dat format.
I am looking for fetching these data from device through any of the network computers other than manually copying to pendrive from the device each time.
Is it possible to download data from device through any of the network machines Using C# code ?
I am getting a excel sheet in datatable with some column "Program,Response,T,Timein".There is 3 condition for filtering datatable.
1.fetch unique program.so i got dis.
2.T not equal to "B". I also got dis.
3.Response should be > 5000. I also got dis data in datatable.
Now in Datatable I have same program name presented 3 times with response>5000 nd T<>B.Now I want to fetch only the maximum respnse among 3 of them. so every time my program should be change and for that program I need to pickup max response so How can I do this? for the same I put two loops
for (int i = 0; i < DataFilter.Rows.Count; i++) {
DataRow dr = DataFilter.Rows[i];
DataView dv2 = new DataView();
[Code]....
I am having some column say "Response" column in my Datatable.Now I want to fetch this particular column value and compare this value with the maximum response how to fetch and compare it in C#.net .. This is my code.
for (int i = 0; i < DataFilter.Rows.Count; i++) {
DataRow dr = DataFilter.Rows[i];
DataView dv2 = new DataView();
dv2 = DataFilter.DefaultView;
[Code] ......
i have a spec for fetch the files from server and predict the un-used files from the directory in this situation i am going to fetch the files from server it will return huge files, the problem is the cpu usage will increase while i am fetching large files, so i like to eliminate this scenario.
View 1 Replies View RelatedI fetch maxid row to view in datagridview using the following code :
public static DataTable GetMaximpID() {
string strconn = AlShehabi.Properties.Settings.Default.NewSalariesDBConnectionString;
SqlConnection conn = new SqlConnection(strconn);
if (conn.State == ConnectionState.Closed)
[Code] ....
But I want to fetch all rows inserted and view in datagridview.... For example if user insert 4 rows I want to view them in datagridview after insert them using insertbutton_click....
I have a thread that fetch elements from a std:queue, which are pushed from other threads. My question is how can I fetch elements from the queue in a blocking mode, what I mean is if there are no elements in the queue then the fetch call will block until at least one element is pushed. Of course I want to do it this way to avoid polling.
View 6 Replies View RelatedI want to write my own application which would fetch some data from a web site. I need to parse the HTML code of the web site and get the data.
About the application:A form (main form) that will contain data arranged in rows. Some of the data comes from a web site and some of it comes from a database.The data that comes from the web site needs to be updated every few seconds so I need to keep fetching the data from the web site.The main form will contain a button "add" which when clicked will add a new row. New data can be added to this row by the user.
I am not sure what to use for this. I have been writing the application as a Windows Form Application (Visual C#) but I do not know whether this is the best choice. Should it be a windows form application or web application? Should I use something else?
I have a SSD and I am trying to use it to simulate my program I/O performance, however, IOPS calculated from my program is much much faster than IOMeter.
My SSD is PLEXTOR PX-128M3S, by IOMeter, its max 512B random read IOPS is around 94k (queue depth is 32). However my program (32 windows threads) can reach around 500k 512B IOPS, around 5 times of IOMeter!!! I did data validation but didn't find any error in data fetching. It's because my data fetching in order?
I paste my code belwo (it mainly fetch 512B from file and release it; I did use 4bytes (an int) to validate program logic and didn't find problem).
#include <stdio.h>
#include <Windows.h>
/*
** Purpose: Verify file random read IOPS in comparison with IOMeter
**/
//Global variables
long completeIOs = 0;
long completeBytes = 0;
int threadCount = 32;
unsigned long long length = 1073741824; //4G test file
[Code] ....
/*assume array is already initialized and declared and is of array type string.*/
int i = 2;
int j = 1;
string newvalue;
cout<<"Current value at array[i][j] is "<<array[i][j]<<endl;
cout<<"Enter new value "<<endl;
cin>>newvalue;
array[i][j]= newvalue; //PROBLEM IS IN THIS LINE.
cout<<endl;
cout<<array[i][j]<<endl;
I'm having lots of trouble with storing a cin string text into a string array. It just seem that after I cin newvalue, the program crashes. Is this way of storing it considered illegal? I'm just a beginner with 5 months of coding experience in C++.
I have a problem i have a textbox filled with info when the button is click but what i need to do now is when new info is place in the textbox i need the results textbox's to clear and the new info put in the textbox.
i know how to clear the textbox
txtVolume.Text = string.Empty;
But it just keeps the textbox empty.
I have a pointer to a C string that contains multiple lines of text. I need to change a few characters in the string (possibly adding 1-2 extra). At the moment my code looks like this (char **objectData is the pointer):
Code:
char temp[350];
char* end = strstr (*objectData, "word_before_data_changes");
strncpy (temp, *objectData, 39); // Copying the first 39 symbols
strncat (temp, "6-11", 4); // inputting some data
strncat (temp, end, 100); // copying the last symbols.
I don't know how many there would be. Tried sizeof(end), but this cropped off last two lines for some reason. So using 100 at the moment. This sort of works, but I think it also adds some new lines or null-terminating characters in the end or something like that, because data parser cannot parse the modified data after that.
I use VC++ 2010 Express. I want to make windows form app. I want to make something like this
#include <fstream>
...
...
...
ofstream File(vardas->Text + " " + pavarde->Text + ".txt");
And I get this:
Form1.h(201): error C2664: 'std::basic_ofstream<_Elem,_Traits>::basic_ofstream(const char *,std::ios_base::openmode,int)' : cannot convert parameter 1 from 'System::String ^' to 'const char *'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
I got those textboxes. What conversions do i have to do?
I would like to make a sort of text parser, in which one enters a string, and it is broken by the whitespaces into chunks, and those chunks compared to different "dictionaries" where the words are assigned a value. For example if the operator enters "take lamp" it would separate "take" and "lamp" and then produce preassigned values for each of these words.
View 3 Replies View RelatedI have a program here that writes employee information into a text file called employee.txt. I don't have a problem writing into the text file.
I'm supposed to enter the employees ID and search for it. Then pull up all they're info.
This is what I have.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main(){
ifstream inFile;
ofstream outFile;
[Code] ....
This is the text file
Viktor,Luc,552,123 Home,5000
Joe,Luc,553,123 House,7000
I'm trying to make a program that will read in names and grades from a text file and print them in the console. However whenever I try to use the OpenFile.get function I get an error saying that there is "no instance of overloaded function"
getting this error resolved before I can.
my code so far (I know it's missing a lot, but that's not what I'm worried about right now.)
#include <fstream>
#include <iostream>
#include <string>
[Code]....
I want to convert an enum to a text string.
enum BREED {YORKIE,CAIRN,DANDIE,SHETLAND,DOBERMAN,LAB};
I need to read from a text file and search for a string that appears in the file and then count how many times it appears. My count just prints zero though. Do you see what I did wrong in my code for this to happen?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
[Code]....
I'm working on a program that can load all words from a dictionary "English2.txt" (it's attached to the post), then put every word into a 2-dimensional matrix (every line is reserved for one word) and display them. After loading every word into a matrix, when I try to display first 8 words with printf, I can't do it without '' at the end of a line. Otherwise only the 8th word is displayed... What's more, when I try to read the length of the first word with strlen, it says, that it has 4 characters (in fact there are only 3 and it's the word "AAA"). What could be the reason for that?
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
int main()
{
FILE *fp;
char buffer[32];
[Code]...
I'm making a program in which it will read an input from a text file and then count the numbers of spaces , characters , words . Here is what i think it would work : First i will transfer the contents from the input.txt into a string , after that i will create 3 strings which contain each of these : spaces , characters , words . Then comparing each of the contents of the intput.txt_string to the other 3 strings .
#include<iostream>
#include<fstream>
#include<string.h>
using namespace std;
[code]....
and of course it doesnt seem to work...
I'm trying to read all content from a text file into a string. This is the code I'm using for it (I know there are other, maybe better ways to do it but I'd like to stick to this for now):
char* buffer;
std::string data;
FILE* fp = fopen("textfile.txt", "rb");
if (!fp) {
printf("Can't open file");
[Code] ....
So my problem is that I get an exception when I try to free the memory -> 0xC0000005: Access violation reading location 0x51366199
I even get the exception when I try to free it immediately after calloc() but why this is.
And if I use buffer = (char*)malloc(lSize); I don't get any exceptions.
So, why this fails and what I'm doing wrong.
I want to make a string array from strings in a text file. Itry to do this but i couldn't do, where is my mistake?
Code:
#include <stdio.h>
#include <stdlib.h>
int main(){
char cumle[100],*c,*dene[50];
FILE *input;
input=fopen("input.txt","r");
[Code]...
I need to make program which converts text (letters and digits only) into 7-digit ascii code. The start and end code is "1100011", so it must not appear inside the output code, thus a zero should be added in it (11000011).
Not that it matters much what my task is - I have a problem. Here's the code:
Code:
#include <iostream>
#include <stdlib.h>
using namespace std;
int main() {
string in,out="",pk="1100011";
getline(cin,in);
[Code] ....
The 'pk' string loses its value here when I enter a character in the input and I cant figure out why... I got that the problem is somewhere in the first if loop, since the code prints pk nicely when cout is before the loop (comment 1)..however, after the loop (comment 2) it prints nothing..... When compiled, it works nice when I input numbers, but 1 character - and 'pk' disappears...
My question is simply how do I center the lines on top of one another using setw (without the use of an additional header file or an additional function)?
I've attempted
Code:
setfill(' ')
to no avail as well.
I can manually set the numbers of setw of course, but I was hoping for alternative smarter fix (without having to pain staking manually set & test each setw).
Note for reason I cannot use an additional header file or function: I've always wanted to know if this could even be done without the use of the <strings> header file (and without the use of an accompanying function). That, and I wanted to reduce the amount of lines of code if possible. If there's not an easier way that's fine (just wanted to know if setw or setfill could get the centering job done alone).
I didn't think it could be done (I believe with the header files I have and place & with no additional functional support one would have to simply manually set each setw).
Code:
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main() {
char Enter;
[Code] ....
I have two puzzling issues I am dealing with.
Issue 1: I am using a stringstream object in a block of my program that needs to be visited repeatedly depending on a user's selection from a menu. I want the contents of this stringstream object to be cleared any time control gets to this part of the program. I have tried the clear and flush functions to no avail.
Issue 2: I am reading data from a source text file that would be regularly changed during the course of program run. After the program run is over, I am supposed to save the results(which is basically the source text file AND all updates) in a destination file. This destination file would then serve as the source file when next the program is run. In other words, I want a scenario where my results overwrite the original contents of the source file; implying that my source and destination files are now one, pretty much. How can I do this?
I am trying to print a specific line from a textfile
e.g
I have a text file called info.txt and inside it contains the id,item name, price, quantity
Code:
1,shirt,100,10
2,pants,50,9
3,pen,20,8
I know how to find a specific word at the line in the file but how do I find and print out the specific line e.g(print out just the entire contents of line 2)?
Code:
string temDescription;
ofstream fout;
int curLine = 0;
[Code].....