My question is clear ^^ How to clear keyboard buffer?

Member Avatar
Member Avatar
+0 forum 3

I'm trying to get values from DataGridView to the another form in textboxes and in Picturebox ,data in textboxes are there ok, but when I try to get a picture in a picturebox from DB it gives me this error. Buffer cannot be null Parameter name :buffer and here is the code Private Sub dgv1_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV1.CellDoubleClick Dim frm As New Edit_Employee() frm.MdiParent = Mainfrm frm.Show() frm.TextBox1.Text = DGV1.Rows(e.RowIndex).Cells(1).Value.ToString frm.TextBox2.Text = DGV1.CurrentRow.Cells(2).Value.ToString frm.TextBox3.Text = DGV1.CurrentRow.Cells(3).Value.ToString frm.TextBox4.Text = DGV1.CurrentRow.Cells(4).Value.ToString frm.TextBox5.Text = DGV1.CurrentRow.Cells(5).Value.ToString frm.TextBox6.Text = DGV1.CurrentRow.Cells(6).Value.ToString frm.TextBox7.Text = DGV1.CurrentRow.Cells(7).Value.ToString frm.TextBox8.Text = DGV1.CurrentRow.Cells(8).Value.ToString frm.DateTimePicker1.Text = DGV1.CurrentRow.Cells(9).Value.ToString …

Member Avatar
Member Avatar
+0 forum 9

Hello everyone, I am working on one program that generates a lot of data...eventually it can be in GB range. And the way I am doing it now is just by writing to ascii file everything time... like this: ofstream flowC("outputfile.out"); // declared at the start flowC << prevsid << ", " << threadid << endl; // inside working block - repeats many many times However, this is not very efficient. First because I am writing ascii and because I am writing to dick every single time. To improve this.. I want to write 2nd line above to a buffer …

Member Avatar
Member Avatar
+0 forum 4

So, I'm trying out a project on my own because I have no real clue how to do anything complex or useful in C++ (applications for example). This project calls for creating a simple console text editor with basic functionality (buffer, command set, redisplay). The problem is that I don't understand the buffer step. How do you decide where the gap starts in a gap buffer? I have searched online for ages but can't find any definitive source on how the algorithm for the data structure actually works. I guess what I'm trying to say is that this is my …

Member Avatar
Member Avatar
+0 forum 7

Hello, Today I was working on my home Pc. As I work my 2nd job from home. I was working away and clicked some random news site and all of a sudden Mcfee says they have blocked a trojan, and then get a little box pops up wanting me to approve windows to run something I click no and keep working. The box keeps popping up. <br Mind you the `internet is working fine at thi `internet is working fine at this point. I restart my PC in safe mode with networking, to run a virus scan. I notice my …

Member Avatar
Member Avatar
+0 forum 1

Hi, I've just started learning Python and for my first script I wanted to make something that would make life easier and that I would actually use, so starting small I've began working on a Torrent Search script that uses the ISOHunt API. However I've ran into a problem in the unfinished method that cleans the results from the search: def sanitise(string): a = string.split('{"title":') # split page into parts, a is list for i in range(len(a)): a[i].lower() # lower every char on page index = a[i].find('"enclosure_url":') b = a[i].replace(a[:index], "") print a[i] Here's an example search result: <b>Inception</b>.FRENCH.DVDRip.XViD-DVDFR", "link":"http:\/\/isohunt.com\/torrent_details\/255340617\/inception?tab=summary", …

Member Avatar
Member Avatar
+0 forum 2

Hey guys, I'm loading from a dictionary with a variable called "buffer". I'm trying to copy "buffer" in to another array word for word. For some reason, when I try using `strncpy()`, it yields a segfault. Here is my code (assuming "LETTERS" is 29: bool load(string filename) { // open dictionary FILE* file = fopen(filename, "r"); if (file == NULL) return false; // load words from dictionary char buffer[LETTERS + 2]; int size = 0; while (fgets(buffer, LETTERS + 2, file)) { // overwrite \n with \0 buffer[strlen(buffer) - 1] = '\0'; strncpy(arrayList[size], buffer, LETTERS + 2); size++; } return …

Member Avatar
Member Avatar
+0 forum 3

Good evening all, Currently I am working on a program that will automate the backup/restore jobs at the place I work. The rough work has been done, but I am somewhat concerned about the possibility of massive IO operations due to the way my program works. Here is the scenario: My colleagues and me sometimes have to do PC transfers. Copying all relevant userdata from one PC, to a networklocation, set up the new PC, copy from network to new PC.= Our servers/NAS/network are all up to par, so they won't be a problem. But some users still gather quite …

Member Avatar
Member Avatar
+0 forum 14

Hi, I'm doing a study planner in java. I'm doing a simple login system. For every user who registers a text file is created holding all of the information inputted during registration. This is the code of a method which the program uses to login the user: public void loginUser(){ r = new Registration(); r.username = txtUser.getText(); r.password = txtPass.getText(); try{ String line; SubjectFrame subject = new SubjectFrame(); BufferedReader f = new BufferedReader(new FileReader(r.username + ".txt")); while((item = f.readLine()) != null){ if(line.equals(r.password)){ dispose(); subject = new SubjectFrame(); subject.setSize(700,600); subject.setLocation(100,100); subject.setVisible(true); }else{ System.out.println("No"); } } f.close(); }catch(Exception e){ JOptionPane.showMessageDialog(null, "Wrong information!", …

Member Avatar
Member Avatar
+0 forum 3

int main(void) { char faceValue[2]; char suitValue[2]; //User enters the value of their hole cards. setCardFaceValue(faceValue); setCardSuitValue(suitValue); for(int i=0;i<2;i++) printf("Element %i: %c %c\n",i,faceValue[i],suitValue[i]); return 0; } void setCardFaceValue(char* face) { char card[2][20] = {"left card:","right card:"}; for(int i=0;i<2;i++) { printf("Enter face value for "); for(int x=0;x<19;x++) { printf("%c",card[i][x]); if(card[i][x] == ':') { fgets(&face[i],3,stdin); } } } } void setCardSuitValue(char* suit) { char card[2][20] = {"left card:","right card:"}; for(int i=0;i<2;i++) { printf("Enter suit value for "); for(int x=0;x<19;x++) { printf("%c",card[i][x]); if(card[i][x] == ':') { fgets(&suit[i],3,stdin); } } } } Here is the output: [Click Here](http://gyazo.com/6fe495527ffdb35a7ba066c26be24bac) The value entered for the first …

Member Avatar
Member Avatar
+0 forum 5

Hi. I'm having a problem with a module in a program written in powerbuilder An event is triggered when the user change the focus to a specified textbox the event creates local variables that I set to null, then I read a string that comes from the lecture of a driver licence. The string returned is ALWAYS in order, so I tokenize it according a specified character and save the tokens in my local variables The problem that Im having is that my program reads the string in different order. For example, the string I recieve is always in the …

Member Avatar
Member Avatar
+0 forum 2

[CODE]Sub retrievepic() Dim conn As New SqlConnection("data source=.\sqlexpress; integrated security=true; attachdbfilename=|datadirectory|\WAIS.mdf; user instance=true;") Dim cmd As New SqlCommand("select ImageData from ImagesStore where ImageId=@ImageId", conn) cmd.Parameters.AddWithValue("@ImageId", 3) Try conn.Open() PictureBox1.Image = Image.FromStream(New IO.MemoryStream(CType(cmd.ExecuteScalar, Byte()))) Catch ex As Exception MsgBox(ex.Message) Finally conn.Close() End Try End Sub [/CODE] This is my code for retrieving pictures, it was working before but then i accidentally deleted the table and i created it again with the same name and same fields. and now whenever i open the form with the picture, there was a message box error. it says Buffer cannot be null. Parameter name: buffer …

Member Avatar
Member Avatar
+0 forum 5

[CODE]print "creating a text file" text_file = open("write_it.txt", "a") score = 5 name = raw_input("What's your name?: ") score = (score, name) text_file.write(score) text_file.close()[/CODE] getting TypeError: expected a character buffer object Please help. Thanks

Member Avatar
Member Avatar
+0 forum 5

So I have a component that renders very slowly. The problem is that I can only render inside the event handling thready, which shouldn't be freezed. Long ago in pascal/assembly I used backbuffer and page flipping. I've read that Java supports double buffering, but no info about thread safety. So the question is, how can I render in a worker thread, and then show it in the event handling one? Thanks!

Member Avatar
Member Avatar
+0 forum 1

HI, I am looking for faster input and output method for the C other than just normal scanf and printf modules. Please elaborate by simple example. thanks :)

Member Avatar
Member Avatar
+0 forum 8

I'm using sockets in C to write 10 bytes to a socket and then read 10 bytes from that socket. I create a parent process that forks, creating a child that acts as the socket server that writes the 10 bytes. After the 10 bytes are wrote, back in the parent, those 10 bytes get read from the socket. This is what is supposed to happen. My current output just shows the server "waiting". I'm not sure what's causing the hangup between the parent/child but any help or suggestions would be much appreciated. Here's my code below. [CODE] #include <stdlib.h> …

Member Avatar
Member Avatar
+0 forum 8

Hi! I read the clearing input buffer article on the top of the c++ forum but I don't really get it, and it doesn't work. This is my problem, I know that cin is just like a file in that it has a buffer (correct me if I'm wrong, I think I'm right) and can use the same things that istream objects can use. so, that (if I'm right) would mean that this is legal [ICODE]cin.ignore[/ICODE]. but for some reason it's not... what's wrong? the error occurs in just the one spot and it seems to not be related to …

Member Avatar
Member Avatar
+0 forum 2

Can anyone please give me a guideline on how to code the following? I have an MFC application which should call on a timer basis a python script from command line and read the ouput of that command line. I thought of using CreateProcess, but i have no clue of how am i going to read the output of the python script which is sent to the command line buffer. Is there any standard way of doing this? Thanks in advance.

Member Avatar
Member Avatar
+0 forum 2

I'm working on a project that utilizes producers and consumers for an operating systems class. Each producer and each consumer will be its own thread. The producers will generate records that will be stored in a global buffer, in which the consumer will then access to use the data. I am having a hard time figuring out how to use actual pthreads. My original plan was to create a Producer class and a Consumer class and simulate the threads, but we are told now not to do so. Is there a c++ class for this? Also, for the buffer, I …

Member Avatar
Member Avatar
+0 forum 10

Hi all, i'm working on some exercises which i have to load data from Image library. I write a load function and it work fine except when the number of images in the library becomes large. At this moment, the limited number if around 700 images. When the number reaches to a larger number, there will be error like this [URL="http://img248.imageshack.us/f/error1gv.png/"]http://img248.imageshack.us/f/error1gv.png/[/URL] Belove is my function: [CODE]void Image::load_Image_From_BMP() { FILE *ImageFile; if (FAILED(fopen_s(&ImageFile,fileLink,"rb"))) { MessageBox(NULL,L"File doesn't exist",L"ImageLoader.exe",MB_OK); return; } fread(&bmfh,sizeof(BITMAPFILEHEADER),1,ImageFile); fread(&bmih,sizeof(BITMAPINFOHEADER),1,ImageFile); dataR = (unsigned char**)malloc(sizeof(unsigned char*)* bmih.biHeight); dataG = (unsigned char**)malloc(sizeof(unsigned char*)* bmih.biHeight); dataB = (unsigned char**)malloc(sizeof(unsigned char*)* bmih.biHeight); dataA = …

Member Avatar
Member Avatar
+0 forum 3

Hello guys, this is my first post, so don't be harsh if I do something stupid. Well, the reason why I'm posting here is because I need to find a method to alter the stream itself, not just the buffer I send to a variable with "file.Read(". For example, lets say i have a file whose bytes are as follows: 05 FF 3E 23 80 BD As I'm using MFC I'd use 'file.Open' to open the file, and 'file.Read' to send the stream above to a buffer (char *) variable. What I want to do is to change the stream …

Member Avatar
Member Avatar
+0 forum 5

How do I properly bubble sort through a text file by assigning the values to an array. In the code below I tried to assign the values from the text file to a string while there is still something to fetch. Then I used a for loop to assign the one that I have fetch to the array. [CODE] ttry{ int i; String ss; FileReader fr; fr = new FileReader (new File("F:\\players.txt")); BufferedReader br = new BufferedReader (fr); while ((ss = br.readLine()) != null) { String[] sv = ss.split(" "); String splayer_name=sv[1]; String s_player_score=sv[2]; for(int xy=0;xy<player_name.length;xy++){ player_name[xy]=splayer_name; player_score[xy]=Integer.parseInt(s_player_score); } int …

Member Avatar
Member Avatar
+0 forum 5

Im trying to do a screen-flashing application that flashes the screen depending on the audio(like an audio visualizer, but instead of a visualization like bars or something like that, just flash the screen). I already made the music player and know how to make the widget get full screen and change color(which will flash), but I dont know how to detect the (I think it's audio-card)buffer is full, because when it is full I would change the color of the widget, and this would be really super fast, so the screen flashes super quickly. Any ideas on how to detect …

Member Avatar
Member Avatar
+0 forum 1

I kind of understand the basic concept of adding to the end / overwriting the oldest when the buffer is full, but i am not sure about where to add new data in the buffer when there is free space at the start of the array (the left hand side) but it is already occupied by data at the end (the last few elements). For example... i have an array called 'queue' with 10 elements: queue[0,1,2,3,4,5,6,7,8,9] It currently has 4 items in it, which occupy elements [6][7][8][9], [6] holds the oldest item and [9] holds the newest item. When i …

Member Avatar
Member Avatar
+0 forum 2

Hi, I'm trying to replace an item in a list I made with 0. [CODE]popdata[0][5].replace(0.02,0)[/CODE] when I run this it gives me the error TypeError: expected a character buffer object. I was wondering what this error meant and how I would go about fixing it. Thanks! Elise

Member Avatar
Member Avatar
+0 forum 17

Okay, so I've been looking at this for quite some time. I think I know what the problem is, but my C++ skills are sad a best due to stuff like Java, C# and VB. So, I'm trying to pull information from the registry, and I have no problem getting it to work. I can pull REG_SZ values just fine. I can output them and everything. Now, I'm trying to get REG_DWORDs to work, but am having issues. When I have it look at something that has a DWORD value of like 546258943, the program spits out something like " ?Å …

Member Avatar
Member Avatar
+0 forum 2

Hi, I am attempting to create a dynamic array using realloc in 2 dimensions. Currently i have managed to get it to work using realloc to dynamically resize the amount of rows but when I attempt to use realloc to dynamically resize the amount of columns per row I keep getting errors. I am currently therefore using malloc() to set the amount of columns per row. I think that there is either something wrong in my code, or it is not possible. Below is a rough example of what I am trying to do, could someone please let me know …

Member Avatar
Member Avatar
+0 forum 7

Hey guys, first time poster, relatively long time reader -- I am struggling creating a buffer class in python for my class. (relatively new to the language). Here is the basic idea I want to do: Implement a class that buffers text. The write() method adds a string to the buffer. If the added data contains a '*', print the buffer contents to the console up until and including the '*'. Example use: buffer = Buffer() buffer.write ('abcd') # prints nothing buffer.write ('ef*gh') # prints abcdef* buffer.flush () # prints gh I get the basic idea, of how to call …

Member Avatar
Member Avatar
+0 forum 3

Hello everybody. I'm trying to get the current directory, save it, changing the current dir, then coming back to the previous one. My code so far [code=asm] TITLE ep1_7 .MODEL SMALL .STACK 10h .DATA msg DB 'Current directory:',0h msg_l equ $-msg buff db 64 dup('$') ;f_handle dw 1 dup(?) .CODE begin: mov ax,@DATA mov ds,ax ;Getting current directory mov ah,47h mov dl,0 mov ds,buff ;showing the returned pathname mov dx,OFFSET buff mov ah,09h int 21h ;bail out mov ax,4c00h int 21h END begin [/code] My problem is that i have an error at line 15. I don't know how to …

Member Avatar
Member Avatar
+0 forum 1

The End.