Hi guys! I would like to ask you a question about on how to save data on a text file using visual basic. I have a hard time getting the right code for this function. Does anybody of you know a simple code that you can share to me. I appreciate any answers that you will share to me... Thank you and more power to us programmers!!! :)

Member Avatar
Member Avatar
+0 forum 2

I have a static function that write to a log file . In my project I am already using multithreading , hense I m getting exception that 'process can't access file because it is being used by another process ' I want to mutex that code so that if one thread is accessing that code then another will have to wait. Here is the code. [code] { private static Mutex mut = new Mutex(); mut.WaitOne(); StreamWriter sw = new StreamWriter(path + "\\" + logFileName, true); sw.WriteLine(stMessage); sw.Close(); mut.ReleaseMutex(); } [/code]

Member Avatar
Member Avatar
+0 forum 5

Hello, I was trying to implement data structures using file operations. I am using a data structure of two integers, one being the index number and other being the value. My actual aim is to recreate the file containing the data using a log. But, the program isn't running as required. Please help. I am giving the code: [CODE] ifstream rlist; rlist.open("redo.txt",ios::in); ofstream datt; datt.open("datatemp.txt",ios::out); dat c; char s; while(!rlist.eof()){ rlist>>s; if(s=='I'){ rlist.read((char*) &c,sizeof c); datt.write((char*) &c,sizeof c); } if(s=='D'){ ifstream rlistd; rlistd.open("datatemp.txt",ios::in); rlist.read((char*) &c,sizeof c); ofstream rlistdw; dat s; rlistdw.open("datatem.txt",ios::out); while(!rlistd.eof()){ rlistd.read((char *) &s, sizeof s); if((s.a)!=(c.a)) rlistdw.write((char*) &s, …

Member Avatar
Member Avatar
+0 forum 5

Hi all, I need to store some data in a txt file from a textbox.text. I have try this and works: [code] FileInfo t = new FileInfo("data.txt"); StreamWriter Txt =t.CreateText(); Txt.WriteLine(textbox1.text); Txt.Close(); [/code] But.... How can I create multiple files without delete the older one, e.g., Gives the name to the file like "current time and date".txt This code is to use with a button click event. Thanks a lot, Chrom

Member Avatar
Member Avatar
+1 forum 5

I want to write a Code in C which can create copy any given file (txt, bmp, jpg, pdf etc) what i've written so far is: int main(){ FILE *fp; char ch; FILE *fpW; if((fpW = fopen("file2.bmp","w"))==NULL) { printf("Cannot open Destination file.\n"); exit(1); } if((fp = fopen("file.bmp","r"))==NULL) { printf("Cannot open Source file.\n"); exit(1); } while((ch = fgetc( fp )) != EOF) { fputc(ch, fpW); } fclose(fp); fclose(fpW); //printf("\n %s \n",ret); return 0; } it works fine with txt file but doesn't work with pdf and image files .... please Help ..!!

Member Avatar
Member Avatar
+0 forum 6

The End.